fix(whiteboard): only allow pan when middle button is pressed
This commit is contained in:
@@ -3841,7 +3841,7 @@ export class TldrawApp extends StateManager<TDSnapshot> {
|
|||||||
|
|
||||||
private get_viewbox_from_svg = (svgStr: string | ArrayBuffer | null) => {
|
private get_viewbox_from_svg = (svgStr: string | ArrayBuffer | null) => {
|
||||||
if (typeof svgStr === 'string') {
|
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');
|
return viewBox.children[0].getAttribute('viewBox');
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4125,7 +4125,7 @@ export class TldrawApp extends StateManager<TDSnapshot> {
|
|||||||
};
|
};
|
||||||
|
|
||||||
onPointerDown: TLPointerEventHandler = (info, e) => {
|
onPointerDown: TLPointerEventHandler = (info, e) => {
|
||||||
if (e.buttons === 4) {
|
if (e.button === 1) {
|
||||||
this.patchState({
|
this.patchState({
|
||||||
settings: {
|
settings: {
|
||||||
forcePanning: true,
|
forcePanning: true,
|
||||||
@@ -4142,6 +4142,13 @@ export class TldrawApp extends StateManager<TDSnapshot> {
|
|||||||
};
|
};
|
||||||
|
|
||||||
onPointerUp: TLPointerEventHandler = (info, e) => {
|
onPointerUp: TLPointerEventHandler = (info, e) => {
|
||||||
|
if (e.button === 1) {
|
||||||
|
this.patchState({
|
||||||
|
settings: {
|
||||||
|
forcePanning: false,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
this.isPointing = false;
|
this.isPointing = false;
|
||||||
this.updateInputs(info, e);
|
this.updateInputs(info, e);
|
||||||
this.currentTool.onPointerUp?.(info, e);
|
this.currentTool.onPointerUp?.(info, e);
|
||||||
|
|||||||
Reference in New Issue
Block a user