You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A more sophisticated view system could be a powerful addition to deck.gl. Since it is starting to look like we have a long list of ideas around view system improvements, it is probably best to collect them and ensure that any changes we make fit into the bigger picture.
In Infovis, adding synchronized timelines and legend views would benefit from width: 'calc(100% - 250px)' type expressions.
It is not hard to implement the CSS spec and handle most of the supported units.
View override logic (declarative)
Views: ViewState prop override support for object / array values?
Views can be declared with props that override viewState. But this does not handle partial overrides like zoom: [2,] or position: [,,10] well.
Such props are more common in the non-geospatial view states.
View filtering
Currently deck.layerFilter has to be a "global" function.
Add support for a declarative version, a list or map of strings to include or exclude, a list of regexps etc.
Allow layer filters to be specified on views?
Allow view filters to be specified on layers?
Intuitiveness of filtering API: Filtering can gets stuck on composite layers, preventing actual layers from rendering, not super intuitive. Maybe multiple ways to address this.
Perhaps there is a difference in internal composite layers and primary composite layers?
Nesting Layers in Views.
An alternative to view filtering is to allow layers to be nested in views.
views: [newOrthographicView({layers: ....})]
LayerGroups? - a problem occurs when wanting to render a group of layers in multiple views. By defining a LayerGroup:
Use views instead of children for row, column, and overlay.
Pro: This reads closer to deck.gl and SplitterWidgetViewLayout.
Downside: overlay can contain layout nodes and spacers too, so children is semantically a little more accurate.
Use orientation for split layouts, keep type only for non-split nodes
Split containers use orientation.
Overlay/spacer keep type: 'overlay' | 'spacer'.
This is closest to the old syntax, but the union becomes less uniform.
ViewLayout Compared To CSS
CSS is a useful benchmark for whether the ViewLayout API feels obvious. The current API maps most closely to a constrained subset of Flexbox plus absolute-positioned overlays.
CSS concept
Current ViewLayout equivalent
Fit
display: flex; flex-direction: row/column
`type: 'row'
'column'ororientation`
Flex item fixed basis
child width / height
Strong
Flex item min/max
minPixels / maxPixels
Good, but less CSS-like naming
position: absolute inside parent
overlay + child x/y/width/height
Strong
padding
inset
Reasonable, but CSS would call this padding
gap
manual spacer
Weak
flex-grow / fr units
flexible unspecified children divide remaining equally
Basic only
CSS Grid named areas
none
Missing
minmax() / clamp()
width: '50%' + minPixels/maxPixels
Good conceptually
subgrid
nested layouts
Similar spirit, simpler
container queries
caller recompiles with measured size
Similar responsibility, not declarative
anchor positioning
viewPropsById / overlay offsets
Partial
resize/split panes
splitId + splittersById
Not CSS, but app-layout-specific
The biggest CSS-like gaps are:
No gap
Spacer works, but it is verbose. A gap: 8 prop on row/column would feel natural and map directly to CSS flex/grid.
No flex weights
Today unspecified children divide remaining space equally. CSS users may expect something like flex: 2 or weight: 2.
Axis-dependent minPixels / maxPixels
This is pragmatic, but CSS would likely spell this as minWidth / maxWidth and minHeight / maxHeight, or minSize / maxSize for stack-axis sizing.
No named grid/areas
If the API wants to compete with CSS Grid, it would need named cells or areas. That may be too much for the current PR.
Generated split ids are less CSS-like than line names
CSS Grid has named lines. A closer model might be splitIds: ['sidebar-main', 'main-inspector'] for multi-child splits. Generated ids are simpler, but less authored and less semantic.
Suggested docs language:
ViewLayout is closest to a constrained subset of Flexbox plus absolute-positioned overlays. Rows and columns distribute space, children may declare fixed or percentage sizes plus pixel min/max constraints, and overlay children are positioned within their parent rect.
For future CSS-inspired API additions, the highest-value options are gap and flex / weight.
CSS grid
CSS grids could be nice, to make a number of views for different cities etc. For “N city views” the current row/column API gets awkward because you either manually nest rows/columns or generate a tree. A grid layout would be more natural:
The Follow-up "PoC" PR adds a number experimental widgets, website example, playground JSON sample, and widget docs, this is mainly for exposition at the moment, to show the system working and things that could be built by users.
Target Use Case
deck view system
A more sophisticated view system could be a powerful addition to deck.gl. Since it is starting to look like we have a long list of ideas around view system improvements, it is probably best to collect them and ensure that any changes we make fit into the bigger picture.
Proposal
Views
Improved declarative support
calc()expressions? Add layout expressions for view positions #9842width: 'calc(100% - 250px)'type expressions.View override logic (declarative)
zoom: [2,]orposition: [,,10]well.View filtering
Add support for a declarative version, a list or map of strings to include or exclude, a list of regexps etc.
Allow layer filters to be specified on views?
Allow view filters to be specified on layers?
Intuitiveness of filtering API: Filtering can gets stuck on composite layers, preventing actual layers from rendering, not super intuitive. Maybe multiple ways to address this.
Nesting Layers in Views.
LayerGroups? - a problem occurs when wanting to render a group of layers in multiple views. By defining aLayerGroup:or
View Override logic
ViewState manipulation logic
A number of widgets are implementing hacky ways to manipulate the view state.
Controllers
View Layout RFC
Changes
buildViewsFromViewLayout, including view reuse, length parsing, split metadata, andviewPropsByIdbounds overrides.@deck.gl/widgetsanddeck.gl.View Layout Syntax Audit
We do have a point of reference in existing 9.3 splitter widget which provides a minimal layout syntax for its
viewspropThe closest change would be to let the new compiler accept a split-container shape that mirrors
<item>.orientation<item>.layout<item>.orientation: horizontal<item>.layout: row<item>.layout: 'horizontal'<item>: verticallayout: columnSplitterWidgetProps.views<item>.childrenchildrencan be layout items not just viewsSplitterWidgetViewLayout:
This would map internally to the proposed:
How to align?
Use views instead of children for row, column, and overlay.
Split containers use orientation.
ViewLayout Compared To CSS
CSS is a useful benchmark for whether the
ViewLayoutAPI feels obvious. The current API maps most closely to a constrained subset of Flexbox plus absolute-positioned overlays.display: flex; flex-direction: row/columnororientation`width/heightminPixels/maxPixelsposition: absoluteinside parentoverlay+ childx/y/width/heightpaddinginsetpaddinggapflex-grow/frunitsminmax()/clamp()width: '50%'+minPixels/maxPixelssubgridviewPropsById/ overlay offsetssplitId+splittersByIdThe biggest CSS-like gaps are:
No
gapSpacer works, but it is verbose. A
gap: 8prop on row/column would feel natural and map directly to CSS flex/grid.No flex weights
Today unspecified children divide remaining space equally. CSS users may expect something like
flex: 2orweight: 2.Axis-dependent
minPixels/maxPixelsThis is pragmatic, but CSS would likely spell this as
minWidth/maxWidthandminHeight/maxHeight, orminSize/maxSizefor stack-axis sizing.No named grid/areas
If the API wants to compete with CSS Grid, it would need named cells or areas. That may be too much for the current PR.
Generated split ids are less CSS-like than line names
CSS Grid has named lines. A closer model might be
splitIds: ['sidebar-main', 'main-inspector']for multi-child splits. Generated ids are simpler, but less authored and less semantic.Suggested docs language:
For future CSS-inspired API additions, the highest-value options are
gapandflex/weight.CSS
gridCSS grids could be nice, to make a number of views for different cities etc. For “N city views” the current row/column API gets awkward because you either manually nest rows/columns or generate a tree. A grid layout would be more natural:
Stacked PRs
The Follow-up "PoC" PR adds a number experimental widgets, website example, playground JSON sample, and widget docs, this is mainly for exposition at the moment, to show the system working and things that could be built by users.