Skip to content

Commit

Permalink
disable pointer events on hidden menus in zen mode (excalidraw#1511)
Browse files Browse the repository at this point in the history
  • Loading branch information
dwelle authored Apr 29, 2020
1 parent 0c2aa95 commit 51f8146
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 8 deletions.
4 changes: 4 additions & 0 deletions src/components/LayerUI.scss
Original file line number Diff line number Diff line change
Expand Up @@ -111,3 +111,7 @@
}
}
}

.disable-pointerEvents {
pointer-events: none !important;
}
9 changes: 6 additions & 3 deletions src/components/LayerUI.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,10 @@ const LayerUI = ({
<FixedSideContainer side="top">
<HintViewer appState={appState} elements={elements} />
<div className="App-menu App-menu_top">
<Stack.Col gap={4}>
<Stack.Col
gap={4}
className={zenModeEnabled && "disable-pointerEvents"}
>
{renderCanvasActions()}
{shouldRenderSelectedShapeActions && renderSelectedShapeActions()}
</Stack.Col>
Expand Down Expand Up @@ -201,7 +204,7 @@ const LayerUI = ({
{
<div
className={`App-menu App-menu_bottom zen-mode-transition ${
zenModeEnabled && "transition-left"
zenModeEnabled && "transition-left disable-pointerEvents"
}`}
>
<Stack.Col gap={2}>
Expand All @@ -225,7 +228,7 @@ const LayerUI = ({
<footer role="contentinfo" className="layer-ui__wrapper__footer">
<div
className={`zen-mode-transition ${
zenModeEnabled && "transition-right"
zenModeEnabled && "transition-right disable-pointerEvents"
}`}
>
<LanguageList
Expand Down
2 changes: 1 addition & 1 deletion src/components/LockIcon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export function LockIcon(props: LockIconProps) {
return (
<label
className={`ToolIcon ToolIcon__lock ToolIcon_type_floating ${sizeCn} zen-mode-visibility ${
props.zenModeEnabled && "hidden"
props.zenModeEnabled && "hidden disable-pointerEvents"
}`}
title={`${props.title} — Q`}
>
Expand Down
21 changes: 17 additions & 4 deletions src/components/Stack.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,19 @@ type StackProps = {
gap?: number;
align?: "start" | "center" | "end" | "baseline";
justifyContent?: "center" | "space-around" | "space-between";
className?: string | boolean;
};

function RowStack({ children, gap, align, justifyContent }: StackProps) {
function RowStack({
children,
gap,
align,
justifyContent,
className,
}: StackProps) {
return (
<div
className="Stack Stack_horizontal"
className={`Stack Stack_horizontal ${className || ""}`}
style={
{
"--gap": gap,
Expand All @@ -26,10 +33,16 @@ function RowStack({ children, gap, align, justifyContent }: StackProps) {
);
}

function ColStack({ children, gap, align, justifyContent }: StackProps) {
function ColStack({
children,
gap,
align,
justifyContent,
className,
}: StackProps) {
return (
<div
className="Stack Stack_vertical"
className={`Stack Stack_vertical ${className || ""}`}
style={
{
"--gap": gap,
Expand Down

0 comments on commit 51f8146

Please sign in to comment.