Refactor: results expose Element as a named field
Every component result type now names its element Element instead of embedding *ui.Element. The eleven element-plus-changed results (AccordionView, CarouselView, CollapsibleView, ImageViewerView, PaginationResult, StepsResult, SidebarResult, TabsResult, RatingParts, FileDropZoneParts, TransferParts) fold into ChoiceResult. Fixes four Gallery demos where .Width(...).Changed() read the element's flag instead of the component's: Accordion, MultiSelect, Cascader, TreeSelect. TestDataAccordionDemoLogsChange covers the Accordion.
This commit is contained in:
73 files changed
+163
-245
No files matched your search
+3
-12
@@ -20,15 +20,6 @@ type ViewerImage struct {
|
||||
Alt string
|
||||
}
|
||||
|
||||
// ImageViewerView is a built ImageViewer; Element is nil while closed.
|
||||
type ImageViewerView struct {
|
||||
*ui.Element
|
||||
changed bool
|
||||
}
|
||||
|
||||
// Changed reports that another image was chosen.
|
||||
func (v ImageViewerView) Changed() bool { return v.changed }
|
||||
|
||||
// Zoom limits, as multiples of the fitted size.
|
||||
const (
|
||||
viewerMinZoom = 0.25
|
||||
@@ -42,9 +33,9 @@ type viewerState struct {
|
||||
zoom, x, y float32
|
||||
}
|
||||
|
||||
// ImageViewer shows images[*index] over the window while *open, with zoom, pan and switching.
|
||||
func ImageViewer(c *ui.Context, open *bool, index *int, images []ViewerImage) ImageViewerView {
|
||||
var v ImageViewerView
|
||||
// ImageViewer shows images[*index] over the window while *open, with zoom, pan and switching; Element is nil while closed.
|
||||
func ImageViewer(c *ui.Context, open *bool, index *int, images []ViewerImage) ChoiceResult {
|
||||
var v ChoiceResult
|
||||
if !*open {
|
||||
return v
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user