MCPcopy Create free account
hub / github.com/GraphiteEditor/Graphite / onPotentialDoubleClick

Function onPotentialDoubleClick

frontend/src/utility-functions/input.ts:178–198  ·  view source on GitHub ↗
(e: MouseEvent, editor: EditorWrapper)

Source from the content-addressed store, hash-verified

176// Mouse events
177
178export function onPotentialDoubleClick(e: MouseEvent, editor: EditorWrapper) {
179 if (textToolInteractiveInputElement || inPointerLock) return;
180
181 // Allow only events within the viewport or node graph boundaries
182 const isTargetingCanvas = e.target instanceof Element && e.target.closest("[data-viewport], [data-viewport-container], [data-node-graph]");
183 if (!(isTargetingCanvas instanceof Element)) return;
184
185 // Allow only repeated increments of double-clicks (not 1, 3, 5, etc.)
186 if (e.detail % 2 == 1) return;
187
188 // `e.buttons` is always 0 in the `mouseup` event, so we have to convert from `e.button` instead
189 let buttons = 1;
190 if (e.button === BUTTON_LEFT) buttons = 1; // Left
191 if (e.button === BUTTON_RIGHT) buttons = 2; // Right
192 if (e.button === BUTTON_MIDDLE) buttons = 4; // Middle
193 if (e.button === BUTTON_BACK) buttons = 8; // Back
194 if (e.button === BUTTON_FORWARD) buttons = 16; // Forward
195
196 const modifiers = makeKeyboardModifiersBitfield(e);
197 editor.onDoubleClick(e.clientX, e.clientY, buttons, modifiers);
198}
199
200export function onMouseDown(e: MouseEvent) {
201 // Block middle mouse button auto-scroll mode (the circular gizmo that appears and allows quick scrolling by moving the cursor above or below it)

Callers 1

input.tsFile · 0.90

Calls 1

Tested by

no test coverage detected