Repository: onlook-dev/onlook
File: apps/web/client/src/app/project/[id]/_components/canvas/frame/gesture.tsx (TypeScript)

Code before:
                const shouldGetStyle = [MouseAction.MOUSE_DOWN, MouseAction.DOUBLE_CLICK].includes(
                    action,
                );
                const el: DomElement = await frameData.view.getElementAtLoc(
                    pos.x,
                    pos.y,
                    shouldGetStyle,
                );
                if (!el) {
                    throw new Error('No element found');
                }

                switch (action) {
                    case MouseAction.MOVE:
                        editorEngine.elements.mouseover(el);
                        if (e.altKey) {
                            if (editorEngine.state.editorMode !== EditorMode.INSERT_IMAGE) {
                                editorEngine.overlay.showMeasurement();
                            }
                        } else {
                            editorEngine.overlay.removeMeasurement();
                        }
                        break;
                    case MouseAction.MOUSE_DOWN:
                        if (el.tagName.toLocaleLowerCase() === 'body') {
                            editorEngine.frames.select([frame], !e.shiftKey);
                            return;
                        }
                        // Ignore right-clicks
                        if (e.button == 2) {
                            break;
                        }
                        if (editorEngine.text.isEditing) {
                            await editorEngine.text.end();
                        }
                        if (e.shiftKey) {
                            editorEngine.elements.shiftClick(el);
                        } else {
                            editorEngine.elements.click([el]);
                            await editorEngine.move.start(el, pos, frameData);
                        }
                        break;
                    case MouseAction.DOUBLE_CLICK:
                        editorEngine.text.start(el, frameData.view);
                        break;
                }
            } catch (error) {
                console.error('Error handling mouse event:', error);
                return;
            }
        },

Review comment (suggestion):
I'd recommend a parameter where you don't have to pass the opposite param. 
Something like multiselect = false will allow passing `e.shiftKey` instead of `!e.shiftKey` and make it easier to understand

Code after:
                const shouldGetStyle = [MouseAction.MOUSE_DOWN, MouseAction.DOUBLE_CLICK].includes(
                    action,
                );
                const el: DomElement = await frameData.view.getElementAtLoc(
                    pos.x,
                    pos.y,
                    shouldGetStyle,
                );
                if (!el) {
                    throw new Error('No element found');
                }

                switch (action) {
                    case MouseAction.MOVE:
                        editorEngine.elements.mouseover(el);
                        if (e.altKey) {
                            if (editorEngine.state.editorMode !== EditorMode.INSERT_IMAGE) {
                                editorEngine.overlay.showMeasurement();
                            }
                        } else {
                            editorEngine.overlay.removeMeasurement();
                        }
                        break;
                    case MouseAction.MOUSE_DOWN:
                        if (el.tagName.toLocaleLowerCase() === 'body') {
                            editorEngine.frames.select([frame], e.shiftKey);
                            return;
                        }
                        // Ignore right-clicks
                        if (e.button == 2) {
                            break;
                        }
                        if (editorEngine.text.isEditing) {
                            await editorEngine.text.end();
                        }
                        if (e.shiftKey) {
                            editorEngine.elements.shiftClick(el);
                        } else {
                            editorEngine.elements.click([el]);
                            await editorEngine.move.start(el, pos, frameData);
                        }
                        break;
                    case MouseAction.DOUBLE_CLICK:
                        editorEngine.text.start(el, frameData.view);
                        break;
                }
            } catch (error) {
                console.error('Error handling mouse event:', error);
                return;
            }
        },