fix(whiteboard): only allow pan when middle button is pressed

This commit is contained in:
austaras
2022-08-18 17:26:11 +08:00
committed by Austaras
parent d9c123a9b9
commit 6915c9c2a5
@@ -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');
}
@@ -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,
@@ -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);