Skip to content

Commit

Permalink
Only let specific drag events be defaulted in the pan && zoom handler
Browse files Browse the repository at this point in the history
  • Loading branch information
ALevansSamsung committed Dec 27, 2024
1 parent ae0fd1f commit 6c65c98
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion ui/src/frontend/panel_container.ts
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ export class PanelContainer implements m.ClassComponent<Attrs> {
'.scroll-limiter',
m('canvas.main-canvas'),
),
m('.panels', {ondragstart: (e: DragEvent) => e.preventDefault()}, children),
m('.panels', children),
];
}

Expand Down
3 changes: 0 additions & 3 deletions ui/src/frontend/track_panel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -432,9 +432,6 @@ export class TrackContent implements m.ClassComponent<TrackContentAttrs> {
this.mouseDownX = e.layerX;
this.mouseDownY = e.layerY;
},
ondragstart: (e:DragEvent) => {
e.preventDefault();
},
onmouseup: (e: PerfettoMouseEvent) => {
if (this.mouseDownX === undefined ||
this.mouseDownY === undefined) {
Expand Down
5 changes: 5 additions & 0 deletions ui/src/frontend/viewer_page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,11 @@ class TraceViewer implements m.ClassComponent<TraceViewerAttrs> {
}
globals.makeSelection(Actions.deselect({}));
},
ondragstart: (e :DragEvent)=>{
if (!(e.dataTransfer && e.dataTransfer.types.find((format)=>format.startsWith('perfetto/')))) {
e.preventDefault();
}
},
},
m('.pinned-panel-container', m(PanelContainer, {
doesScroll: false,
Expand Down

0 comments on commit 6c65c98

Please sign in to comment.