disable pointer events on hidden menus in zen mode (#1511)

This commit is contained in:
David Luzar 2020-04-29 22:49:36 +02:00 committed by GitHub
parent 0c2aa951d6
commit 51f8146357
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 28 additions and 8 deletions

View File

@ -111,3 +111,7 @@
} }
} }
} }
.disable-pointerEvents {
pointer-events: none !important;
}

View File

@ -169,7 +169,10 @@ const LayerUI = ({
<FixedSideContainer side="top"> <FixedSideContainer side="top">
<HintViewer appState={appState} elements={elements} /> <HintViewer appState={appState} elements={elements} />
<div className="App-menu App-menu_top"> <div className="App-menu App-menu_top">
<Stack.Col gap={4}> <Stack.Col
gap={4}
className={zenModeEnabled && "disable-pointerEvents"}
>
{renderCanvasActions()} {renderCanvasActions()}
{shouldRenderSelectedShapeActions && renderSelectedShapeActions()} {shouldRenderSelectedShapeActions && renderSelectedShapeActions()}
</Stack.Col> </Stack.Col>
@ -201,7 +204,7 @@ const LayerUI = ({
{ {
<div <div
className={`App-menu App-menu_bottom zen-mode-transition ${ className={`App-menu App-menu_bottom zen-mode-transition ${
zenModeEnabled && "transition-left" zenModeEnabled && "transition-left disable-pointerEvents"
}`} }`}
> >
<Stack.Col gap={2}> <Stack.Col gap={2}>
@ -225,7 +228,7 @@ const LayerUI = ({
<footer role="contentinfo" className="layer-ui__wrapper__footer"> <footer role="contentinfo" className="layer-ui__wrapper__footer">
<div <div
className={`zen-mode-transition ${ className={`zen-mode-transition ${
zenModeEnabled && "transition-right" zenModeEnabled && "transition-right disable-pointerEvents"
}`} }`}
> >
<LanguageList <LanguageList

View File

@ -46,7 +46,7 @@ export function LockIcon(props: LockIconProps) {
return ( return (
<label <label
className={`ToolIcon ToolIcon__lock ToolIcon_type_floating ${sizeCn} zen-mode-visibility ${ className={`ToolIcon ToolIcon__lock ToolIcon_type_floating ${sizeCn} zen-mode-visibility ${
props.zenModeEnabled && "hidden" props.zenModeEnabled && "hidden disable-pointerEvents"
}`} }`}
title={`${props.title} — Q`} title={`${props.title} — Q`}
> >

View File

@ -7,12 +7,19 @@ type StackProps = {
gap?: number; gap?: number;
align?: "start" | "center" | "end" | "baseline"; align?: "start" | "center" | "end" | "baseline";
justifyContent?: "center" | "space-around" | "space-between"; 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 ( return (
<div <div
className="Stack Stack_horizontal" className={`Stack Stack_horizontal ${className || ""}`}
style={ style={
{ {
"--gap": gap, "--gap": gap,
@ -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 ( return (
<div <div
className="Stack Stack_vertical" className={`Stack Stack_vertical ${className || ""}`}
style={ style={
{ {
"--gap": gap, "--gap": gap,