|
|
@@ -538,11 +538,10 @@ class SymjaConsole {
|
|
|
if (legendEl) container.appendChild(legendEl);
|
|
|
}
|
|
|
|
|
|
- // 保存按钮 + 图例开关
|
|
|
- const actions = document.createElement('div');
|
|
|
- actions.className = 'plot-actions';
|
|
|
-
|
|
|
+ // 图例开关(仅在多曲线时显示)
|
|
|
if (legendEl) {
|
|
|
+ const actions = document.createElement('div');
|
|
|
+ actions.className = 'plot-actions';
|
|
|
const legendBtn = document.createElement('button');
|
|
|
legendBtn.className = 'plot-save-btn';
|
|
|
legendBtn.textContent = '🏷 图例';
|
|
|
@@ -552,14 +551,19 @@ class SymjaConsole {
|
|
|
legendBtn.style.opacity = legendVisible ? '1' : '0.5';
|
|
|
};
|
|
|
actions.appendChild(legendBtn);
|
|
|
+ container.appendChild(actions);
|
|
|
}
|
|
|
|
|
|
- const saveBtn = document.createElement('button');
|
|
|
- saveBtn.className = 'plot-save-btn';
|
|
|
- saveBtn.textContent = '💾 保存图片';
|
|
|
- saveBtn.onclick = () => this.savePlot(canvas);
|
|
|
- actions.appendChild(saveBtn);
|
|
|
- container.appendChild(actions);
|
|
|
+ // 长按保存(单指静止800ms触发)
|
|
|
+ let longPressTimer;
|
|
|
+ canvas.addEventListener('touchstart', (e) => {
|
|
|
+ clearTimeout(longPressTimer);
|
|
|
+ if (e.touches.length === 1) {
|
|
|
+ longPressTimer = setTimeout(() => this.savePlot(canvas), 800);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ canvas.addEventListener('touchend', () => clearTimeout(longPressTimer));
|
|
|
+ canvas.addEventListener('touchmove', () => clearTimeout(longPressTimer));
|
|
|
|
|
|
line.appendChild(container);
|
|
|
this.output.appendChild(line);
|