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

View file

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