From 448ac7c82bd712528ae7521ee220eb725e136920 Mon Sep 17 00:00:00 2001 From: AlexandreSi <32449369+AlexandreSi@users.noreply.github.com> Date: Tue, 17 Sep 2024 09:57:52 +0200 Subject: [PATCH] Hide selected instance buttons when painting --- newIDE/app/src/InstancesEditor/SelectedInstances.js | 8 +++++++- newIDE/app/src/InstancesEditor/index.js | 3 +++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/newIDE/app/src/InstancesEditor/SelectedInstances.js b/newIDE/app/src/InstancesEditor/SelectedInstances.js index 277185da8faf..152c4f097055 100644 --- a/newIDE/app/src/InstancesEditor/SelectedInstances.js +++ b/newIDE/app/src/InstancesEditor/SelectedInstances.js @@ -18,6 +18,7 @@ import KeyboardShortcuts from '../UI/KeyboardShortcuts'; type Props = {| instancesSelection: InstancesSelection, instanceMeasurer: InstanceMeasurer, + shouldDisplayHandles: () => boolean, onResize: ( deltaX: number, deltaY: number, @@ -72,6 +73,7 @@ const resizeGrabbingIconNames = { export default class SelectedInstances { instancesSelection: InstancesSelection; instanceMeasurer: InstanceMeasurer; + shouldDisplayHandles: () => boolean; onResize: ( deltaX: number, deltaY: number, @@ -105,6 +107,7 @@ export default class SelectedInstances { constructor({ instancesSelection, instanceMeasurer, + shouldDisplayHandles, onResize, onResizeEnd, onRotate, @@ -118,6 +121,7 @@ export default class SelectedInstances { }: Props) { this.instanceMeasurer = instanceMeasurer; this.onResize = onResize; + this.shouldDisplayHandles = shouldDisplayHandles; this.onResizeEnd = onResizeEnd; this.onRotate = onRotate; this.onRotateEnd = onRotateEnd; @@ -303,6 +307,7 @@ export default class SelectedInstances { buttonPadding, hitAreaPadding, } = getButtonSizes(this._screenType); + const displayHandle = this.shouldDisplayHandles(); const selection = this.instancesSelection.getSelectedInstances(); let x1 = 0; let y1 = 0; @@ -368,7 +373,8 @@ export default class SelectedInstances { // If there are no unlocked instances, hide the resize buttons. const show = - selection.filter(instance => !instance.isLocked()).length !== 0; + selection.filter(instance => !instance.isLocked()).length !== 0 && + displayHandle; // Position the resize buttons. for (const grabbingLocation of resizeGrabbingLocationValues) { diff --git a/newIDE/app/src/InstancesEditor/index.js b/newIDE/app/src/InstancesEditor/index.js index 698d95434bf0..6ee6d2f99e2b 100644 --- a/newIDE/app/src/InstancesEditor/index.js +++ b/newIDE/app/src/InstancesEditor/index.js @@ -505,6 +505,7 @@ export default class InstancesEditor extends Component { }); this.selectedInstances = new SelectedInstances({ instancesSelection: this.props.instancesSelection, + shouldDisplayHandles: this.shouldDisplayClickableHandles, onResize: this._onResize, onResizeEnd: this._onResizeEnd, onRotate: this._onRotate, @@ -733,6 +734,8 @@ export default class InstancesEditor extends Component { return { color: isLocked ? 0xbc5753 : 0x6868e8, alpha: 1 }; }; + shouldDisplayClickableHandles = () => !this.props.tileMapTileSelection; + getZoomFactor = () => { return this.props.instancesEditorSettings.zoomFactor; };