Skip to content

Commit

Permalink
fix(whiteboard): only allow pan when middle button is pressed
Browse files Browse the repository at this point in the history
  • Loading branch information
Austaras committed Aug 18, 2022
1 parent d9c123a commit 6915c9c
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions libs/components/board-state/src/tldraw-app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3841,7 +3841,7 @@ export class TldrawApp extends StateManager<TDSnapshot> {

private get_viewbox_from_svg = (svgStr: string | ArrayBuffer | null) => {
if (typeof svgStr === 'string') {
let viewBox = new DOMParser().parseFromString(svgStr, 'text/xml');
const viewBox = new DOMParser().parseFromString(svgStr, 'text/xml');
return viewBox.children[0].getAttribute('viewBox');
}

Expand Down Expand Up @@ -4125,7 +4125,7 @@ export class TldrawApp extends StateManager<TDSnapshot> {
};

onPointerDown: TLPointerEventHandler = (info, e) => {
if (e.buttons === 4) {
if (e.button === 1) {
this.patchState({
settings: {
forcePanning: true,
Expand All @@ -4142,6 +4142,13 @@ export class TldrawApp extends StateManager<TDSnapshot> {
};

onPointerUp: TLPointerEventHandler = (info, e) => {
if (e.button === 1) {
this.patchState({
settings: {
forcePanning: false,
},
});
}
this.isPointing = false;
this.updateInputs(info, e);
this.currentTool.onPointerUp?.(info, e);
Expand Down

0 comments on commit 6915c9c

Please sign in to comment.