From aec6a426ed1b988b79e1bf3fe7a9ec8d0e6c75e0 Mon Sep 17 00:00:00 2001 From: HuangHai <10402852@qq.com> Date: Wed, 10 Sep 2025 07:52:32 +0800 Subject: [PATCH] 'commit' --- dsLightRag/static/XingJun/js/script.js | 107 +++++++++++++++++-------- dsLightRag/static/XingJun/move.html | 7 +- 2 files changed, 74 insertions(+), 40 deletions(-) diff --git a/dsLightRag/static/XingJun/js/script.js b/dsLightRag/static/XingJun/js/script.js index 4c099b6b..f4350c73 100644 --- a/dsLightRag/static/XingJun/js/script.js +++ b/dsLightRag/static/XingJun/js/script.js @@ -46,20 +46,21 @@ document.addEventListener('DOMContentLoaded', function() { // 修改全局偏移量输入框事件监听 - const globalStopDistanceInput = document.getElementById('global-stop-distance'); - - // 初始化全局偏移量(从localStorage加载或使用默认值) - const savedGlobalStopDistance = localStorage.getItem('globalStopDistance'); - if (savedGlobalStopDistance) { - globalStopDistanceInput.value = savedGlobalStopDistance; - } - - // 全局偏移量变更事件 - 保存到localStorage无需选中箭头 - globalStopDistanceInput.addEventListener('input', function() { - const globalValue = this.value; - localStorage.setItem('globalStopDistance', globalValue); - console.log(`[全局设置] 箭头停止距离: ${globalValue}px`); - }); + // 删除以下全局停止距离相关代码 + // const globalStopDistanceInput = document.getElementById('global-stop-distance'); + // + // // 初始化全局偏移量(从localStorage加载或使用默认值) + // const savedGlobalStopDistance = localStorage.getItem('globalStopDistance'); + // if (savedGlobalStopDistance) { + // globalStopDistanceInput.value = savedGlobalStopDistance; + // } + // + // // 全局偏移量变更事件 - 保存到localStorage无需选中箭头 + // globalStopDistanceInput.addEventListener('input', function() { + // const globalValue = this.value; + // localStorage.setItem('globalStopDistance', globalValue); + // console.log(`[全局设置] 箭头停止距离: ${globalValue}px`); + // }); @@ -69,9 +70,9 @@ document.addEventListener('DOMContentLoaded', function() { const arrowHeight = ARROW_HEIGHT; const centerOffsetX = arrowWidth / 2; const centerOffsetY = arrowHeight / 2; - // 使用全局偏移量替换单个箭头的stopDistance - const stopDistance = parseInt(document.getElementById('global-stop-distance').value) || STOP_DISTANCE; - + // 使用当前箭头的停止距离,默认为50 + const stopDistance = parseInt(arrow.dataset.stopDistance) || 50; + const rect = arrow.getBoundingClientRect(); const containerRect = backgroundContainer.getBoundingClientRect(); let currentX = rect.left - containerRect.left + centerOffsetX; @@ -233,19 +234,48 @@ document.addEventListener('DOMContentLoaded', function() { container.style.top = (y - centerOffsetY) + 'px'; } - // 双击编辑文字 + // 双击编辑文字和停止距离 container.addEventListener('dblclick', (e) => { e.stopPropagation(); const currentText = container.dataset.text || ''; - // 使用layui layer.prompt替换原生prompt - layer.prompt({ - title: '请输入文字', - value: currentText, - formType: 3, // 文本输入框类型 - area: ['300px', 'auto'] // 定义弹窗宽度 - }, function(value, index, elem){ - if (value !== null) { - if (value.trim() === '') { + const currentStopDistance = container.dataset.stopDistance || '50'; + + // 创建自定义弹窗内容,使用layui表单样式 + const content = ` +
* 全局设置,所有箭头生效
-