Rename vague variable

This commit is contained in:
Andrew Prifer 2022-10-07 17:32:00 +02:00 committed by Aria Minaei
parent c58bc694ee
commit 0d5b4bd8c8
4 changed files with 14 additions and 13 deletions

View file

@ -8,7 +8,7 @@ import styled from 'styled-components'
import {panelDimsToPanelPosition, usePanel} from './BasePanel'
import {useCssCursorLock} from '@theatre/studio/uiComponents/PointerEventsHandler'
import {clamp} from 'lodash-es'
import {visibleSize} from './common'
import {minVisibleSize} from './common'
const Container = styled.div`
cursor: move;
@ -40,12 +40,12 @@ const PanelDragZone: React.FC<
top: clamp(
stuffBeforeDrag.dims.top + dy,
0,
window.innerHeight - visibleSize,
window.innerHeight - minVisibleSize,
),
left: clamp(
stuffBeforeDrag.dims.left + dx,
-stuffBeforeDrag.dims.width + visibleSize,
window.innerWidth - visibleSize,
-stuffBeforeDrag.dims.width + minVisibleSize,
window.innerWidth - minVisibleSize,
),
}
const position = panelDimsToPanelPosition(newDims, {

View file

@ -9,7 +9,7 @@ import styled from 'styled-components'
import {panelDimsToPanelPosition, usePanel} from './BasePanel'
import {pointerEventsAutoInNormalMode} from '@theatre/studio/css'
import {clamp} from 'lodash-es'
import {visibleSize} from './common'
import {minVisibleSize} from './common'
const Base = styled.div`
position: absolute;
@ -174,7 +174,7 @@ const PanelResizeHandle: React.FC<{
0,
Math.min(
bottom - stuffBeforeDrag.minDims.height,
window.innerHeight - visibleSize,
window.innerHeight - minVisibleSize,
),
)
const height = bottom - top
@ -188,7 +188,7 @@ const PanelResizeHandle: React.FC<{
newDims.left + dx,
Math.min(
right - stuffBeforeDrag.minDims.width,
window.innerWidth - visibleSize,
window.innerWidth - minVisibleSize,
),
)
const width = right - left
@ -200,7 +200,7 @@ const PanelResizeHandle: React.FC<{
newDims.width + dx,
Math.max(
stuffBeforeDrag.minDims.width,
visibleSize - stuffBeforeDrag.dims.left,
minVisibleSize - stuffBeforeDrag.dims.left,
),
)
}

View file

@ -60,4 +60,5 @@ export const TitleBar = styled.div`
text-overflow: ellipsis;
`
export const visibleSize = 100
// the minimum visible width or height when the panel is partially offscreen
export const minVisibleSize = 100

View file

@ -20,7 +20,7 @@ import React, {useEffect, useMemo, useRef, useState} from 'react'
import styled from 'styled-components'
import FocusRangeStrip, {focusRangeStripTheme} from './FocusRangeStrip'
import FocusRangeThumb from './FocusRangeThumb'
import {visibleSize} from '@theatre/studio/panels/BasePanel/common'
import {minVisibleSize} from '@theatre/studio/panels/BasePanel/common'
const Container = styled.div<{isShiftDown: boolean}>`
position: absolute;
@ -190,12 +190,12 @@ function usePanelDragZoneGestureHandlers(
top: clamp(
stuffBeforeDrag.dims.top + dy,
0,
window.innerHeight - visibleSize,
window.innerHeight - minVisibleSize,
),
left: clamp(
stuffBeforeDrag.dims.left + dx,
-stuffBeforeDrag.dims.width + visibleSize,
window.innerWidth - visibleSize,
-stuffBeforeDrag.dims.width + minVisibleSize,
window.innerWidth - minVisibleSize,
),
}
const position = panelDimsToPanelPosition(newDims, {