Bugfix of pointer-event disabling logic on panes (#2118)

* Fix pointer-event logic depending on open panes, etc

* Little KclTextEditorPane style tweaks

* A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)

* A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)

* Rerun CI

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
This commit is contained in:
Frank Noirot
2024-04-15 21:40:45 -04:00
committed by GitHub
parent 9a9c2223de
commit f29573f3dc
4 changed files with 22 additions and 15 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 68 KiB

After

Width:  |  Height:  |  Size: 68 KiB

View File

@ -1,5 +1,6 @@
import { useStore } from 'useStore' import { useStore } from 'useStore'
import styles from './ModelingPane.module.css' import styles from './ModelingPane.module.css'
import { useSettingsAuthContext } from 'hooks/useSettingsAuthContext'
export interface ModelingPaneProps export interface ModelingPaneProps
extends React.PropsWithChildren, extends React.PropsWithChildren,
@ -29,18 +30,21 @@ export const ModelingPane = ({
detailsTestId, detailsTestId,
...props ...props
}: ModelingPaneProps) => { }: ModelingPaneProps) => {
const { settings } = useSettingsAuthContext()
const onboardingStatus = settings.context.app.onboardingStatus
const { buttonDownInStream } = useStore((s) => ({ const { buttonDownInStream } = useStore((s) => ({
buttonDownInStream: s.buttonDownInStream, buttonDownInStream: s.buttonDownInStream,
})) }))
const pointerEventsCssClass =
buttonDownInStream || onboardingStatus.current === 'camera'
? 'pointer-events-none '
: 'pointer-events-auto '
return ( return (
<section <section
{...props} {...props}
data-testid={detailsTestId} data-testid={detailsTestId}
className={ className={
(buttonDownInStream ? 'pointer-events-none ' : 'pointer-events-auto ') + pointerEventsCssClass + styles.panel + ' group ' + (className || '')
styles.panel +
' group ' +
(className || '')
} }
> >
<ModelingPaneHeader title={title} Menu={Menu} /> <ModelingPaneHeader title={title} Menu={Menu} />

View File

@ -15,19 +15,18 @@ interface ModelingSidebarProps {
} }
export function ModelingSidebar({ paneOpacity }: ModelingSidebarProps) { export function ModelingSidebar({ paneOpacity }: ModelingSidebarProps) {
const { buttonDownInStream, openPanes } = useStore((s) => ({ const { settings } = useSettingsAuthContext()
const onboardingStatus = settings.context.app.onboardingStatus
const { openPanes, buttonDownInStream } = useStore((s) => ({
buttonDownInStream: s.buttonDownInStream, buttonDownInStream: s.buttonDownInStream,
openPanes: s.openPanes, openPanes: s.openPanes,
})) }))
const { settings } = useSettingsAuthContext()
const {
app: { onboardingStatus },
} = settings.context
const pointerEventsCssClass = const pointerEventsCssClass =
buttonDownInStream || onboardingStatus.current === 'camera' buttonDownInStream ||
onboardingStatus.current === 'camera' ||
openPanes.length === 0
? 'pointer-events-none ' ? 'pointer-events-none '
: 'pointer-events-auto' : 'pointer-events-auto '
return ( return (
<Resizable <Resizable
@ -41,8 +40,7 @@ export function ModelingSidebar({ paneOpacity }: ModelingSidebarProps) {
handleClasses={{ handleClasses={{
right: right:
(openPanes.length === 0 ? 'hidden ' : 'block ') + (openPanes.length === 0 ? 'hidden ' : 'block ') +
'translate-x-1/2 hover:bg-chalkboard-10 hover:dark:bg-chalkboard-110 bg-transparent transition-colors duration-75 transition-ease-out delay-100 ' + 'translate-x-1/2 hover:bg-chalkboard-10 hover:dark:bg-chalkboard-110 bg-transparent transition-colors duration-75 transition-ease-out delay-100 ',
pointerEventsCssClass,
}} }}
> >
<div className={styles.grid + ' flex-1'}> <div className={styles.grid + ' flex-1'}>
@ -118,6 +116,7 @@ function ModelingSidebarSection({
> >
<Tab.List <Tab.List
className={ className={
'pointer-events-auto ' +
(alignButtons === 'start' (alignButtons === 'start'
? 'justify-start self-start' ? 'justify-start self-start'
: 'justify-end self-end') + : 'justify-end self-end') +

View File

@ -135,9 +135,13 @@ code {
overflow: auto; overflow: auto;
} }
#code-mirror-override .cm-gutter {
@apply select-none;
}
#code-mirror-override .cm-activeLine, #code-mirror-override .cm-activeLine,
#code-mirror-override .cm-activeLineGutter { #code-mirror-override .cm-activeLineGutter {
@apply bg-primary/20; @apply bg-primary/10;
} }
.dark #code-mirror-override .cm-activeLine, .dark #code-mirror-override .cm-activeLine,