Skip to content

Commit

Permalink
Hide selected instance buttons when painting
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexandreSi committed Sep 17, 2024
1 parent 41d8458 commit 448ac7c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
8 changes: 7 additions & 1 deletion newIDE/app/src/InstancesEditor/SelectedInstances.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import KeyboardShortcuts from '../UI/KeyboardShortcuts';
type Props = {|
instancesSelection: InstancesSelection,
instanceMeasurer: InstanceMeasurer,
shouldDisplayHandles: () => boolean,
onResize: (
deltaX: number,
deltaY: number,
Expand Down Expand Up @@ -72,6 +73,7 @@ const resizeGrabbingIconNames = {
export default class SelectedInstances {
instancesSelection: InstancesSelection;
instanceMeasurer: InstanceMeasurer;
shouldDisplayHandles: () => boolean;
onResize: (
deltaX: number,
deltaY: number,
Expand Down Expand Up @@ -105,6 +107,7 @@ export default class SelectedInstances {
constructor({
instancesSelection,
instanceMeasurer,
shouldDisplayHandles,
onResize,
onResizeEnd,
onRotate,
Expand All @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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) {
Expand Down
3 changes: 3 additions & 0 deletions newIDE/app/src/InstancesEditor/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -505,6 +505,7 @@ export default class InstancesEditor extends Component<Props, State> {
});
this.selectedInstances = new SelectedInstances({
instancesSelection: this.props.instancesSelection,
shouldDisplayHandles: this.shouldDisplayClickableHandles,
onResize: this._onResize,
onResizeEnd: this._onResizeEnd,
onRotate: this._onRotate,
Expand Down Expand Up @@ -733,6 +734,8 @@ export default class InstancesEditor extends Component<Props, State> {
return { color: isLocked ? 0xbc5753 : 0x6868e8, alpha: 1 };
};

shouldDisplayClickableHandles = () => !this.props.tileMapTileSelection;

getZoomFactor = () => {
return this.props.instancesEditorSettings.zoomFactor;
};
Expand Down

0 comments on commit 448ac7c

Please sign in to comment.