Pr@dev v2@refactor map wheel event (#15503)

* fix(图表): 修复排序优先级保存不生效

* refactor(图表): 优化地图缩放,只有在选中状态下才响应滚轮事件 #14921
This commit is contained in:
wisonic-s
2025-03-26 22:24:56 +08:00
committed by GitHub
parent c90b6d7e03
commit 3201b6e7f2
3 changed files with 24 additions and 1 deletions

View File

@@ -442,6 +442,8 @@ public class ChartViewManege {
dto.setFlowMapStartName(JsonUtil.parseList(record.getFlowMapStartName(), tokenType));
dto.setFlowMapEndName(JsonUtil.parseList(record.getFlowMapEndName(), tokenType));
dto.setExtColor(JsonUtil.parseList(record.getExtColor(), tokenType));
dto.setSortPriority(JsonUtil.parseList(record.getSortPriority(), new TypeReference<List<SortAxis>>() {
}));
return dto;

View File

@@ -76,6 +76,11 @@ const props = defineProps({
type: String,
required: false,
default: 'inherit'
},
active: {
type: Boolean,
required: false,
default: true
}
})
@@ -779,6 +784,15 @@ onMounted(() => {
useEmitt({ name: 'l7-prepare-picture', callback: preparePicture })
useEmitt({ name: 'l7-unprepare-picture', callback: unPreparePicture })
})
const MAP_CHARTS = ['map', 'bubble-map', 'flow-map', 'heat-map', 'symbolic-map']
const onWheel = (e: WheelEvent) => {
if (!MAP_CHARTS.includes(view.value.type)) {
return
}
if (!props.active) {
e.stopPropagation()
}
}
onBeforeUnmount(() => {
try {
myChart?.destroy()
@@ -801,7 +815,13 @@ onBeforeUnmount(() => {
:style="state.trackBarStyle"
@trackClick="trackClick"
/>
<div v-if="!isError" ref="chartContainer" class="canvas-content" :id="containerId"></div>
<div
@wheel.capture="onWheel"
v-if="!isError"
ref="chartContainer"
class="canvas-content"
:id="containerId"
></div>
<chart-error v-else :err-msg="errMsg" />
</div>
</template>

View File

@@ -1190,6 +1190,7 @@ const clearG2Tooltip = () => {
:element="element"
:suffixId="suffixId"
:font-family="fontFamily"
:active="active"
v-else-if="
showChartView(ChartLibraryType.G2_PLOT, ChartLibraryType.L7_PLOT, ChartLibraryType.L7)
"