Skip to content

Commit 1e3c662

Browse files
author
Cosmo Myzrail Gorynych
committed
⚡ Room editor: you can now navigate around with Spacebar + Left mouse button
Closes what irritates #545
1 parent 33d06f0 commit 1e3c662

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

src/node_requires/roomEditor/IRoomEditorRiotTag.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ export interface IRoomEditorRiotTag extends IRiotTag {
3030
gridOn: boolean;
3131
freePlacementMode: boolean;
3232
controlMode: boolean;
33+
spacebarMode: boolean;
3334
currentTool: tool;
3435
currentTemplate: ITemplate | -1;
3536
setTool(tool: tool): () => void;

src/node_requires/roomEditor/interactions/camera/move.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,10 @@ interface IMoveCameraAffixedData {
1616
const moveCameraOnWheelPress: IRoomEditorInteraction<IMoveCameraAffixedData> = {
1717
ifListener: 'pointerdown',
1818
if(e: PIXI.FederatedPointerEvent) {
19-
// Checks for a pressed mouse wheel
19+
// Checks for a pressed mouse wheel, or Alt+Shift dragging, or Spacebar
2020
return e.button === 1 ||
21-
(e.altKey && e.shiftKey);
21+
(e.altKey && e.shiftKey) ||
22+
this.riotEditor.spacebarMode;
2223
},
2324
listeners: {
2425
pointerdown(e: PIXI.FederatedPointerEvent, roomTag, affixedData) {

src/riotTags/editors/room-editor/room-editor.tag

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,9 @@ room-editor.aPanel.aView(data-hotkey-scope="{asset.uid}")
218218
e.preventDefault();
219219
} else if (e.key === 'Shift') {
220220
this.controlMode = false;
221+
} else if (e.key === ' ') {
222+
this.spacebarMode = true;
223+
e.preventDefault();
221224
}
222225
};
223226
const modifiersUpListener = e => {
@@ -233,6 +236,9 @@ room-editor.aPanel.aView(data-hotkey-scope="{asset.uid}")
233236
} else if (e.key === 'Control' || e.key.Meta) {
234237
this.controlMode = false;
235238
e.preventDefault();
239+
} else if (e.key === ' ') {
240+
this.spacebarMode = false;
241+
e.preventDefault();
236242
}
237243
};
238244
const blurListener = () => {

0 commit comments

Comments
 (0)