Skip to content

Commit

Permalink
fixed height
Browse files Browse the repository at this point in the history
  • Loading branch information
ruggi committed Oct 7, 2024
1 parent d332f5c commit 74a7c44
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
5 changes: 2 additions & 3 deletions editor/src/components/canvas/controls/grid-controls.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ import {
getGridRelatedIndexes,
} from '../canvas-strategies/strategies/grid-helpers'
import { canResizeGridTemplate } from '../canvas-strategies/strategies/resize-grid-strategy'
import { SceneLabelTestID } from './select-mode/scene-label'
import { SCENE_LABEL_HEIGHT } from './select-mode/scene-label'

const CELL_ANIMATION_DURATION = 0.15 // seconds

Expand Down Expand Up @@ -1859,7 +1859,6 @@ export function controlsForGridPlaceholders(gridPath: ElementPath): ControlWithP
}

function sceneTopOffset(canvasScale: number) {
const labelHeight = document.getElementById(SceneLabelTestID)?.getBoundingClientRect().height ?? 0
const borderSkew = 5
return (labelHeight + borderSkew) / canvasScale
return (SCENE_LABEL_HEIGHT + borderSkew) / canvasScale
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import { MultiplayerWrapper } from '../../../../utils/multiplayer-wrapper'
import { getIdOfScene } from '../comment-mode/comment-mode-hooks'
import { optionalMap } from '../../../../core/shared/optional-utils'
import { defaultEither } from '../../../../core/shared/either'
import { SCENE_LABEL_HEIGHT } from './scene-label'

export const RemixSceneLabelPathTestId = (path: ElementPath): string =>
`${EP.toString(path)}-remix-scene-label-path`
Expand Down Expand Up @@ -318,6 +319,7 @@ const RemixSceneLabel = React.memo<RemixSceneLabelProps>((props) => {
textOverflow: 'ellipsis',
borderRadius: borderRadius,
justifyContent: 'space-between',
height: SCENE_LABEL_HEIGHT / scale,
}}
>
<FlexRow style={{ gap: paddingX }}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ import { CanvasOffsetWrapper } from '../canvas-offset-wrapper'
import { isCommentMode, isSelectModeWithArea } from '../../../editor/editor-modes'
import { getElementPathTreeChildren, getSubTree } from '../../../../core/shared/element-path-tree'

export const SCENE_LABEL_HEIGHT = 28 //px

interface SceneLabelControlProps {
maybeHighlightOnHover: (target: ElementPath) => void
maybeClearHighlightsOnHoverEnd: () => void
Expand Down Expand Up @@ -220,7 +222,6 @@ const SceneLabel = React.memo<SceneLabelProps>((props) => {
onMouseDown={labelSelectable ? onMouseDown : NO_OP}
onMouseMove={labelSelectable ? onMouseMove : NO_OP}
data-testid={SceneLabelTestID}
id={SceneLabelTestID}
className='roleComponentName'
style={{
pointerEvents: labelSelectable ? 'initial' : 'none',
Expand All @@ -240,6 +241,7 @@ const SceneLabel = React.memo<SceneLabelProps>((props) => {
borderRadius: borderRadius,
textOverflow: 'ellipsis',
gap: 20,
height: SCENE_LABEL_HEIGHT / scale,
}}
>
<div
Expand Down

0 comments on commit 74a7c44

Please sign in to comment.