mirror of
https://github.com/documenso/documenso.git
synced 2026-09-29 16:24:30 +10:00
fix: stuff
This commit is contained in:
+17
-1
@@ -98,6 +98,14 @@ export const useEnvelopeCanvasMarquee = ({ onSelect, onEmptyClick }: UseEnvelope
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether the pointer was actually dragged, as opposed to a plain click
|
||||||
|
* which leaves the rectangle without an area.
|
||||||
|
*/
|
||||||
|
const isMarqueeDrawn = () => {
|
||||||
|
return selectionRectangle.visible() && selectionRectangle.width() > 0 && selectionRectangle.height() > 0;
|
||||||
|
};
|
||||||
|
|
||||||
const onWindowPointerUp = () => {
|
const onWindowPointerUp = () => {
|
||||||
stopTrackingWindow();
|
stopTrackingWindow();
|
||||||
|
|
||||||
@@ -111,6 +119,14 @@ export const useEnvelopeCanvasMarquee = ({ onSelect, onEmptyClick }: UseEnvelope
|
|||||||
selectionRectangle.visible(false);
|
selectionRectangle.visible(false);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// A plain click is not a selection, the click handler below deals with
|
||||||
|
// it. Selecting here would also match anything whose bounding box merely
|
||||||
|
// contains the point (e.g. a diagonal line), and since this runs after
|
||||||
|
// other window listeners it would override e.g. a content being placed.
|
||||||
|
if (!isMarqueeDrawn()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
onSelectRef.current(selectionRectangle.getClientRect());
|
onSelectRef.current(selectionRectangle.getClientRect());
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -158,7 +174,7 @@ export const useEnvelopeCanvasMarquee = ({ onSelect, onEmptyClick }: UseEnvelope
|
|||||||
|
|
||||||
stage.on('click.marquee tap.marquee', (e) => {
|
stage.on('click.marquee tap.marquee', (e) => {
|
||||||
// A marquee drag just finished, the selection was handled on mouse up.
|
// A marquee drag just finished, the selection was handled on mouse up.
|
||||||
if (selectionRectangle.visible() && selectionRectangle.width() > 0 && selectionRectangle.height() > 0) {
|
if (isMarqueeDrawn()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user