Specify allowed resize direction for dialogs #105
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I intend to extend Dialogs to display floating panels (see #3). For this, I need the panel / dialog to be resizable in only one direction (away from the sticky side).
Since the option to disable resize was already present, and the default allowed resize sides was somewhat arbitrary, I changed the bool
disableResizefor a flag enum allowing to specify which sides are allowed (or none).floatDialog(container: PanelContainer, x: number, y: number, grayoutParent?: PanelContainer,disableResize?: boolean)➡️floatDialog(container: PanelContainer, x: number, y: number, grayoutParent?: PanelContainer,resizeDirection?: ResizeDirection)openInDialog(container: PanelContainer, event, dragOffset: Point,disableResize?: boolean)➡️openInDialog(container: PanelContainer, event, dragOffset: Point,resizeDirection?: ResizeDirection)To disable resize, instead of passing
trueyou know have to passResizeDirection.Noneor0.🚨 NB: If using JS with no type check, forgetting to migrate can silently cause bugs: since
false == 0and(true & 1) == true, passingfalseexplicitly (to enable resizing) will now disable it, while passingtrue(to disable resizing) will now enable it only for the North side.