no message
This commit is contained in:
parent
6d3bf694c1
commit
31a589e863
@ -108,10 +108,7 @@ function drawMiniMap() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function toggle_mini_map(show) {
|
|
||||||
showMiniMap.value = show; // 更新 store 中的状态
|
|
||||||
// nextTick 逻辑移至 watch
|
|
||||||
}
|
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => showMiniMap.value,
|
() => showMiniMap.value,
|
||||||
@ -127,10 +124,7 @@ watch(
|
|||||||
);
|
);
|
||||||
|
|
||||||
function data_change() {
|
function data_change() {
|
||||||
if (!showMiniMap.value) {
|
if (!showMiniMap.value) return;
|
||||||
// 使用 store 中的状态
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
clearTimeout(timer.value);
|
clearTimeout(timer.value);
|
||||||
timer.value = setTimeout(() => {
|
timer.value = setTimeout(() => {
|
||||||
drawMiniMap();
|
drawMiniMap();
|
||||||
@ -173,9 +167,7 @@ function onMousemove(e) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function onMouseup(e) {
|
function onMouseup(e) {
|
||||||
if (!withTransition.value) {
|
if (!withTransition.value) withTransition.value = true;
|
||||||
withTransition.value = true;
|
|
||||||
}
|
|
||||||
const currentMindMap = getMindMapInstance();
|
const currentMindMap = getMindMapInstance();
|
||||||
if (
|
if (
|
||||||
currentMindMap &&
|
currentMindMap &&
|
||||||
@ -205,6 +197,7 @@ function onViewBoxMousemove(e) {
|
|||||||
typeof currentMindMap.miniMap.onViewBoxMousemove === "function"
|
typeof currentMindMap.miniMap.onViewBoxMousemove === "function"
|
||||||
) {
|
) {
|
||||||
currentMindMap.miniMap.onViewBoxMousemove(e);
|
currentMindMap.miniMap.onViewBoxMousemove(e);
|
||||||
|
console.log("onViewBoxMousemove");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -220,36 +213,12 @@ onMounted(() => {
|
|||||||
setSize();
|
setSize();
|
||||||
window.addEventListener("resize", setSize);
|
window.addEventListener("resize", setSize);
|
||||||
window.addEventListener("mouseup", onMouseup);
|
window.addEventListener("mouseup", onMouseup);
|
||||||
|
|
||||||
// 事件总线监听 (请根据您的项目调整)
|
|
||||||
// eventBus.on('toggle_mini_map', toggle_mini_map);
|
|
||||||
// eventBus.on('data_change', data_change);
|
|
||||||
// eventBus.on('view_data_change', data_change); // Vue2 中 view_data_change 和 data_change 调用相同处理函数
|
|
||||||
// eventBus.on('node_tree_render_end', data_change);
|
|
||||||
|
|
||||||
// watch(getMindMapInstance(), (newInstance) => {
|
|
||||||
// if (newInstance && typeof newInstance.on === 'function') {
|
|
||||||
// newInstance.on(
|
|
||||||
// 'mini_map_view_box_position_change',
|
|
||||||
// onViewBoxPositionChange
|
|
||||||
// );
|
|
||||||
// }
|
|
||||||
// }, { immediate: true });
|
|
||||||
|
|
||||||
// 如果初始时就需要显示小地图,可以在这里调用 toggle_mini_map(true)
|
|
||||||
// 或者通过外部事件触发
|
|
||||||
});
|
});
|
||||||
|
|
||||||
onUnmounted(() => {
|
onUnmounted(() => {
|
||||||
window.removeEventListener("resize", setSize);
|
window.removeEventListener("resize", setSize);
|
||||||
window.removeEventListener("mouseup", onMouseup);
|
window.removeEventListener("mouseup", onMouseup);
|
||||||
|
|
||||||
// 事件总线解绑 (请根据您的项目调整)
|
|
||||||
// eventBus.off('toggle_mini_map', toggle_mini_map);
|
|
||||||
// eventBus.off('data_change', data_change);
|
|
||||||
// eventBus.off('view_data_change', data_change);
|
|
||||||
// eventBus.off('node_tree_render_end', data_change);
|
|
||||||
|
|
||||||
const currentMindMap = getMindMapInstance();
|
const currentMindMap = getMindMapInstance();
|
||||||
if (currentMindMap && typeof currentMindMap.off === "function") {
|
if (currentMindMap && typeof currentMindMap.off === "function") {
|
||||||
currentMindMap.off(
|
currentMindMap.off(
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user