'commit'
This commit is contained in:
@@ -6,7 +6,7 @@
|
|||||||
<title>箭头动画</title>
|
<title>箭头动画</title>
|
||||||
<style>
|
<style>
|
||||||
body { margin: 0; padding: 0; height: 100vh; display: flex; overflow: hidden; }
|
body { margin: 0; padding: 0; height: 100vh; display: flex; overflow: hidden; }
|
||||||
.background-container { position: relative; flex: 1; height: 100vh; background-image: url('D:\\dsWork\\dsProject\\dsLightRag\\XingJun\\background.png'); background-position: center; background-repeat: no-repeat; background-size: contain; z-index: 1; }
|
.background-container { position: relative; flex: 1; height: 100vh; background-image: url('background.png'); background-position: center; background-repeat: no-repeat; background-size: contain; z-index: 1; }
|
||||||
.control-panel { width: 200px; background-color: #fff; border-left: 1px solid #ccc; padding: 20px; height: 100vh; box-sizing: border-box; z-index: 2; overflow-y: auto; }
|
.control-panel { width: 200px; background-color: #fff; border-left: 1px solid #ccc; padding: 20px; height: 100vh; box-sizing: border-box; z-index: 2; overflow-y: auto; }
|
||||||
.control-section { margin-bottom: 30px; }
|
.control-section { margin-bottom: 30px; }
|
||||||
.control-section h3 { margin-top: 0; padding-bottom: 10px; border-bottom: 1px solid #eee; }
|
.control-section h3 { margin-top: 0; padding-bottom: 10px; border-bottom: 1px solid #eee; }
|
||||||
@@ -21,19 +21,8 @@
|
|||||||
.arrow-text { position: absolute; top: '100%'; left: '50%'; transform: translateX(-50%); margin-top: '-5px'; font-weight: bold; color: red; font-size: 16px; white-space: nowrap; text-align: center; width: 100%; background-color: rgba(255, 255, 255, 0.8); padding: 3px 8px; border-radius: 4px; }
|
.arrow-text { position: absolute; top: '100%'; left: '50%'; transform: translateX(-50%); margin-top: '-5px'; font-weight: bold; color: red; font-size: 16px; white-space: nowrap; text-align: center; width: 100%; background-color: rgba(255, 255, 255, 0.8); padding: 3px 8px; border-radius: 4px; }
|
||||||
#contextMenu { position: absolute; display: none; background: white; border: 1px solid #ccc; padding: 5px; z-index: 9999; }
|
#contextMenu { position: absolute; display: none; background: white; border: 1px solid #ccc; padding: 5px; z-index: 9999; }
|
||||||
#deleteArrow { padding: 3px 10px; cursor: pointer; }
|
#deleteArrow { padding: 3px 10px; cursor: pointer; }
|
||||||
</style>
|
|
||||||
<style>
|
|
||||||
/* 新增红点样式 */
|
/* 新增红点样式 */
|
||||||
.center-dot {
|
.center-dot { position: absolute; width: 8px; height: 8px; background: red; border-radius: 50%; transform: translate(-50%, -50%); pointer-events: none; z-index: 5; }
|
||||||
position: absolute;
|
|
||||||
width: 8px;
|
|
||||||
height: 8px;
|
|
||||||
background: red;
|
|
||||||
border-radius: 50%;
|
|
||||||
transform: translate(-50%, -50%);
|
|
||||||
pointer-events: none;
|
|
||||||
z-index: 5;
|
|
||||||
}
|
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
@@ -50,6 +39,7 @@
|
|||||||
<div class="image-btn" data-image="./6.png" style="background-image: url('./6.png');"></div>
|
<div class="image-btn" data-image="./6.png" style="background-image: url('./6.png');"></div>
|
||||||
</div>
|
</div>
|
||||||
<button class="save-btn" id="savePositionsBtn">保存位置</button>
|
<button class="save-btn" id="savePositionsBtn">保存位置</button>
|
||||||
|
<button class="save-btn" id="markCenterBtn" style="margin-top: 10px;">标记中心点</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id="contextMenu"><div id="deleteArrow">删除箭头</div></div>
|
<div id="contextMenu"><div id="deleteArrow">删除箭头</div></div>
|
||||||
@@ -60,9 +50,11 @@
|
|||||||
const backgroundContainer = document.querySelector('.background-container');
|
const backgroundContainer = document.querySelector('.background-container');
|
||||||
const imageButtons = document.querySelectorAll('.image-btn');
|
const imageButtons = document.querySelectorAll('.image-btn');
|
||||||
const saveBtn = document.getElementById('savePositionsBtn');
|
const saveBtn = document.getElementById('savePositionsBtn');
|
||||||
|
const markCenterBtn = document.getElementById('markCenterBtn');
|
||||||
const contextMenu = document.getElementById('contextMenu');
|
const contextMenu = document.getElementById('contextMenu');
|
||||||
const deleteArrow = document.getElementById('deleteArrow');
|
const deleteArrow = document.getElementById('deleteArrow');
|
||||||
let selectedArrow = null;
|
let selectedArrow = null;
|
||||||
|
let centerDot = null;
|
||||||
|
|
||||||
// 加载保存的元素
|
// 加载保存的元素
|
||||||
loadAllElements();
|
loadAllElements();
|
||||||
@@ -94,6 +86,32 @@
|
|||||||
selectedArrow = null;
|
selectedArrow = null;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// 标记中心点功能
|
||||||
|
markCenterBtn.addEventListener('click', function() {
|
||||||
|
// 移除旧点
|
||||||
|
if (centerDot) {
|
||||||
|
centerDot.remove();
|
||||||
|
centerDot = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 创建新点
|
||||||
|
function handleMapClick(e) {
|
||||||
|
const rect = backgroundContainer.getBoundingClientRect();
|
||||||
|
const x = e.clientX - rect.left;
|
||||||
|
const y = e.clientY - rect.top;
|
||||||
|
|
||||||
|
centerDot = document.createElement('div');
|
||||||
|
centerDot.className = 'center-dot';
|
||||||
|
centerDot.style.left = x + 'px';
|
||||||
|
centerDot.style.top = y + 'px';
|
||||||
|
|
||||||
|
backgroundContainer.appendChild(centerDot);
|
||||||
|
backgroundContainer.removeEventListener('click', handleMapClick);
|
||||||
|
}
|
||||||
|
|
||||||
|
backgroundContainer.addEventListener('click', handleMapClick);
|
||||||
|
});
|
||||||
|
|
||||||
// 添加箭头函数
|
// 添加箭头函数
|
||||||
function addImageToContainer(imagePath, position = null, textContent = '') {
|
function addImageToContainer(imagePath, position = null, textContent = '') {
|
||||||
const container = document.createElement('div');
|
const container = document.createElement('div');
|
||||||
@@ -221,50 +239,6 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
<div class="control-panel">
|
|
||||||
<div class="control-section">
|
|
||||||
<!-- 在按钮区域新增标记按钮 -->
|
|
||||||
<button class="save-btn" id="markCenterBtn">标记中心点</button>
|
|
||||||
<!-- 原有其他按钮保持不变 -->
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
document.addEventListener('DOMContentLoaded', function() {
|
|
||||||
// 新增中心点相关代码
|
|
||||||
const markCenterBtn = document.getElementById('markCenterBtn');
|
|
||||||
const backgroundContainer = document.querySelector('.background-container');
|
|
||||||
let centerDot = null;
|
|
||||||
|
|
||||||
// 标记中心点功能
|
|
||||||
markCenterBtn.addEventListener('click', function() {
|
|
||||||
// 移除旧点
|
|
||||||
if (centerDot) {
|
|
||||||
centerDot.remove();
|
|
||||||
centerDot = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 创建新点
|
|
||||||
function handleMapClick(e) {
|
|
||||||
const rect = backgroundContainer.getBoundingClientRect();
|
|
||||||
const x = e.clientX - rect.left;
|
|
||||||
const y = e.clientY - rect.top;
|
|
||||||
|
|
||||||
centerDot = document.createElement('div');
|
|
||||||
centerDot.className = 'center-dot';
|
|
||||||
centerDot.style.left = x + 'px';
|
|
||||||
centerDot.style.top = y + 'px';
|
|
||||||
|
|
||||||
backgroundContainer.appendChild(centerDot);
|
|
||||||
backgroundContainer.removeEventListener('click', handleMapClick);
|
|
||||||
}
|
|
||||||
|
|
||||||
backgroundContainer.addEventListener('click', handleMapClick);
|
|
||||||
});
|
|
||||||
|
|
||||||
// 原有JavaScript代码保持不变
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user