mirror of
https://github.com/modrinth/code.git
synced 2026-09-04 22:10:15 +00:00
fix: analytics tooltip not pinned after mobile chart drag (#6724)
This commit is contained in:
+11
-8
@@ -775,19 +775,22 @@ function suppressUpcomingChartClick() {
|
|||||||
}, 350)
|
}, 350)
|
||||||
}
|
}
|
||||||
|
|
||||||
function clearUnpinnedTouchInteraction(ignoreClick: boolean) {
|
function clearUnpinnedTouchInteraction(ignoreClick: boolean, pinHover = false) {
|
||||||
if (props.pinnedSliceIndex !== null) return
|
if (props.pinnedSliceIndex !== null) return
|
||||||
|
|
||||||
|
if (ignoreClick) {
|
||||||
|
suppressUpcomingChartClick()
|
||||||
|
}
|
||||||
|
if (pinHover) {
|
||||||
|
emit('touch-drag')
|
||||||
|
}
|
||||||
|
|
||||||
clearChartActiveState()
|
clearChartActiveState()
|
||||||
updateChartWithoutGeometry()
|
updateChartWithoutGeometry()
|
||||||
|
|
||||||
if (ignoreClick) {
|
if (!pinHover) {
|
||||||
suppressUpcomingChartClick()
|
emit('hover', { visible: false, x: 0, y: 0, sliceIndex: null })
|
||||||
emit('touch-drag')
|
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
|
||||||
emit('hover', { visible: false, x: 0, y: 0, sliceIndex: null })
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleCanvasClickCapture(event: MouseEvent) {
|
function handleCanvasClickCapture(event: MouseEvent) {
|
||||||
@@ -918,7 +921,7 @@ function handleRangePointerEnd(event: PointerEvent) {
|
|||||||
|
|
||||||
if (isRangeSelecting && rangeSelectPointerType === 'touch') {
|
if (isRangeSelecting && rangeSelectPointerType === 'touch') {
|
||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
clearUnpinnedTouchInteraction(true)
|
clearUnpinnedTouchInteraction(true, true)
|
||||||
} else if (isRangeSelecting && startSliceIndex !== null && endSliceIndex !== null) {
|
} else if (isRangeSelecting && startSliceIndex !== null && endSliceIndex !== null) {
|
||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
emit('range-select', { startSliceIndex, endSliceIndex })
|
emit('range-select', { startSliceIndex, endSliceIndex })
|
||||||
|
|||||||
+2
@@ -110,6 +110,8 @@ export function useAnalyticsChartInteractions({
|
|||||||
|
|
||||||
function onTouchDragEnd() {
|
function onTouchDragEnd() {
|
||||||
ignoreUpcomingChartClick()
|
ignoreUpcomingChartClick()
|
||||||
|
if (!hoverState.visible || hoverState.sliceIndex === null) return
|
||||||
|
isHoverPinned.value = true
|
||||||
}
|
}
|
||||||
|
|
||||||
function onChartGeometry(payload: AnalyticsChartGeometryPayload) {
|
function onChartGeometry(payload: AnalyticsChartGeometryPayload) {
|
||||||
|
|||||||
Reference in New Issue
Block a user