支持右键退出创建模式并更新操作提示

This commit is contained in:
2026-11-24 18:11:59 +08:00
parent 0e991dd06f
commit d686a25643
2 changed files with 7 additions and 2 deletions
+6 -1
View File
@@ -139,7 +139,7 @@ function render() {
$('rotate').disabled = (!selections().length && !state.material) || state.view !== 'source';
$('selection-help').hidden = state.view !== 'source' || (!state.material && selections().length < 2);
$('selection-help').textContent = state.material
? '单击空位放置 · R 顺时针旋转 · E 逆时针旋转\n可连续放置 · 红色表示位置不合法\nEsc / 选择工具 / 再次点击同一对象图标:退出创建'
? '单击空位放置 · R 顺时针旋转 · E 逆时针旋转\n可连续放置 · 红色表示位置不合法\n右键退出创建(也可按 Esc 或再次点击同一对象图标)'
: state.copyPreview
? (state.copyPreview.valid ? '副本位置合法:单击放置' : '副本位置不合法:请移动到空位') + ' · R / E 旋转 · 右键取消'
: state.rotationPreview
@@ -468,6 +468,11 @@ function hit(point) {
}
canvas.addEventListener('pointerdown', guarded(event => {
if (state.busy || !state.level) return;
if (state.material && event.button === 2) {
event.preventDefault();
state.material = null; state.hover = null; state.drag = null;
renderLibrary(); render(); message('已退出创建,切换为选择模式'); return;
}
if (pendingExtra()) applyExtra();
const point = gridPoint(event); if (!point) return;
canvas.focus();