Skip to content

Commit

Permalink
feat: modify drag index
Browse files Browse the repository at this point in the history
  • Loading branch information
jahnli committed Nov 27, 2024
1 parent 0a31959 commit b1d82ce
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/split/src/Split.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ export default defineComponent({
: undefined

const isHorizontal = props.direction === 'horizontal'
const isDraggingRef = ref(false)
const isDraggingRef = ref(-1)
const containerElSizeRef = ref(0)
const panelSizes = ref<Array<string | number>>([])
const triggerIndex = ref(-1)
Expand Down Expand Up @@ -218,7 +218,7 @@ export default defineComponent({
}

const onStopDrag = (e: MouseEvent) => {
isDraggingRef.value = false
isDraggingRef.value = -1
if (props.onDragEnd)
props.onDragEnd(e)
off(mouseMoveEvent, document, onDraging)
Expand All @@ -230,6 +230,7 @@ export default defineComponent({
if (props.onDragStart)
props.onDragStart(e)
triggerIndex.value = index
isDraggingRef.value = index
dragStartPos.value = getMousePosition(e)
on(mouseMoveEvent, document, onDraging)
on(mouseUpEvent, document, onStopDrag)
Expand Down Expand Up @@ -413,7 +414,7 @@ export default defineComponent({
<div
class={[
`${mergedClsPrefix}-split__resize-trigger`,
isDragging
isDragging === index
&& `${mergedClsPrefix}-split__resize-trigger--hover`
]}
style={resizeTriggerStyle}
Expand Down

0 comments on commit b1d82ce

Please sign in to comment.