Skip to content

Commit 2057817

Browse files
author
moninla
committed
refactor: make panelPosition.width required and use assignment instead of delete
1 parent e2c23e0 commit 2057817

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed

components/Panel.vue

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,9 @@ const { x, y, isDragging } = useDraggable(panel, {
3030
3131
const { width: windowWidth, height: windowHeight } = useWindowSize()
3232
33-
const panelWidth = ref(position?.width ?? ui.tempadPanelWidth)
33+
const panelWidth = ref(position ? position.width : ui.tempadPanelWidth)
3434
const isResizing = ref(false)
3535
36-
// no need reactive state, directly using variables
3736
let resizeState: {
3837
direction: 'left' | 'right'
3938
startX: number
@@ -103,7 +102,7 @@ function endResize(e: PointerEvent) {
103102
function resetWidth() {
104103
panelWidth.value = ui.tempadPanelWidth
105104
if (position) {
106-
delete position.width
105+
position.width = ui.tempadPanelWidth
107106
}
108107
}
109108
@@ -232,7 +231,7 @@ const resizingCursor = 'ew-resize'
232231
top: 0;
233232
bottom: 0;
234233
width: 8px;
235-
z-index: 100;
234+
z-index: 10;
236235
transition: background-color 0.2s ease;
237236
touch-action: none;
238237
user-select: none;
@@ -265,9 +264,8 @@ const resizingCursor = 'ew-resize'
265264
266265
.tp-panel-main {
267266
flex: 1 1 auto;
268-
/* TODO: find correct way to inject this radius value */
269-
border-bottom-left-radius: var(--radius-lg, 0.8125rem);
270-
border-bottom-right-radius: var(--radius-lg, 0.8125rem);
267+
border-bottom-left-radius: 0.8125rem;
268+
border-bottom-right-radius: 0.8125rem;
271269
}
272270
273271
.tp-panel-header-icon {

ui/state.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export type Options = {
1616
panelPosition: {
1717
left: number
1818
top: number
19-
width?: number
19+
width: number
2020
}
2121
prefOpen: boolean
2222
deepSelectOn: boolean
@@ -36,7 +36,8 @@ export const options = useStorage<Options>('tempad-dev', {
3636
minimized: false,
3737
panelPosition: {
3838
left: window.innerWidth - ui.nativePanelWidth - ui.tempadPanelWidth,
39-
top: ui.topBoundary
39+
top: ui.topBoundary,
40+
width: ui.tempadPanelWidth
4041
},
4142
prefOpen: false,
4243
deepSelectOn: false,

0 commit comments

Comments
 (0)