Skip to content

Version 43: Limit unnecessary layout / position / draw passes

Latest
Compare
Choose a tag to compare
@MasterBel2 MasterBel2 released this 27 Jul 04:41
· 1 commit to CV43 since this release

Agressive changes have been made to how updates are made to reduce the necessary fequency of calculations:

  • Rasterizer has been merged into DrawingGroup.
  • DrawingGroup now uses draw lists by default. See documentation for how to disable this, for cases where it harms performance.
  • Position can now be expected to be called more than once for some Layout calls, where sizing hasn't changed but positioning has (e.g. )
  • Even if rasterization isn't involved, Draw can be called more than once per Position/Layout call.
  • To specifically request an update to any of Layout/Position/Draw, the corresponding property may be set on the relevant DrawingGroup. See Drawer and Component for more detail and example implementations.

To facilitate this:

  • Most components that allow specifying a child no longer make their child editable; instead, when you wish to mutate a child view hierarchy, set the parent's initial child to Box, which allows its child to be changed (via Box:SetChild(newChild)).
  • Rect, MarginAroundRect, and Cell no longer draw decorations. Use Background instead to attach a background.
    (Note that Background doesn't have the rasterizing optimisation that MarginAroundRect did; instead, use nested DrawingGroups to separate the re-drawing profile of different parts of the interface hierarchy.)
  • HorizontalStack, VerticalStack, and StackInPlace no longer make their members public; instead, they must be set/get through methods that copy to/from the internal member array.
  • Other mutable properties for other component types must be changed through methods, similar to above.
  • Some properties are simply no longer mutable.
  • Dimension now has a base constructor that registers for updates with the drawing group; the previous functionality of the Dimension function has moved to AutoScalingDimension.
  • OffsettedViewport is now an overriding extension of DrawingGroup.

Changes to Menu:

  • MenuAnchor now provides menuAnchor:GetMenu() to allow accessing its menu.
  • Menu provides menu:IsMouseOver() which returns whether the user's cursor is over the menu or one of its submenus.
  • Menu's submenu menu items are now a MenuAnchor at the top level, rather than a MarginAroundRect at the top level. (This probably shouldn't be of practical concern to users of the framework.)

Misc other changes:

  • Remove elements with incomplete PrimaryFrame geometry, to prevent log spam and allow interaction
  • Various bugfixes
  • TextEntry & Button store their colours in constants, providing potential to override & set custom styles
  • PrimaryFrame no longer attempts recovery if Layout hasn't been called yet
  • Elements are removed if no PrimaryFrame is present in the view hierarchy
  • HorizontalScrollContainer and VerticalScrollContainer now use the customisable framework.dimension.scrollMultiplier to configure their scroll speed. This should provide the same scrolling experience on a 1080p display, and scale better to larger resolutions.