Skip to content

Commit

Permalink
Rename vague variable
Browse files Browse the repository at this point in the history
  • Loading branch information
AndrewPrifer authored and AriaMinaei committed Dec 31, 2022
1 parent c58bc69 commit 0d5b4bd
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 13 deletions.
8 changes: 4 additions & 4 deletions theatre/studio/src/panels/BasePanel/PanelDragZone.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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, {
Expand Down
8 changes: 4 additions & 4 deletions theatre/studio/src/panels/BasePanel/PanelResizeHandle.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -200,7 +200,7 @@ const PanelResizeHandle: React.FC<{
newDims.width + dx,
Math.max(
stuffBeforeDrag.minDims.width,
visibleSize - stuffBeforeDrag.dims.left,
minVisibleSize - stuffBeforeDrag.dims.left,
),
)
}
Expand Down
3 changes: 2 additions & 1 deletion theatre/studio/src/panels/BasePanel/common.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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, {
Expand Down

0 comments on commit 0d5b4bd

Please sign in to comment.