@blueharford/scrypted-spatial-awareness 0.6.20 → 0.6.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/main.nodejs.js +1 -1
- package/dist/main.nodejs.js.map +1 -1
- package/dist/plugin.zip +0 -0
- package/out/main.nodejs.js +35 -4
- package/out/main.nodejs.js.map +1 -1
- package/out/plugin.zip +0 -0
- package/package.json +1 -1
- package/src/ui/editor-html.ts +35 -4
package/out/plugin.zip
CHANGED
|
Binary file
|
package/package.json
CHANGED
package/src/ui/editor-html.ts
CHANGED
|
@@ -167,6 +167,8 @@ export const EDITOR_HTML = `<!DOCTYPE html>
|
|
|
167
167
|
<button class="btn" id="tool-wall" onclick="setTool('wall')">Draw Wall</button>
|
|
168
168
|
<button class="btn" id="tool-room" onclick="setTool('room')">Draw Room</button>
|
|
169
169
|
<button class="btn" id="tool-zone" onclick="setTool('zone')" style="background: #2e7d32;">Draw Zone</button>
|
|
170
|
+
<button class="btn" id="finish-zone-btn" onclick="finishZoneDrawing()" style="background: #1976d2; display: none;">Finish Zone</button>
|
|
171
|
+
<button class="btn" id="cancel-zone-btn" onclick="cancelZoneDrawing()" style="background: #dc2626; display: none;">Cancel Zone</button>
|
|
170
172
|
<button class="btn" id="tool-camera" onclick="setTool('camera')">Place Camera</button>
|
|
171
173
|
<button class="btn" id="tool-landmark" onclick="setTool('landmark')">Place Landmark</button>
|
|
172
174
|
<button class="btn" id="tool-connect" onclick="setTool('connect')">Connect</button>
|
|
@@ -341,7 +343,7 @@ export const EDITOR_HTML = `<!DOCTYPE html>
|
|
|
341
343
|
<div class="modal-overlay" id="add-zone-modal">
|
|
342
344
|
<div class="modal">
|
|
343
345
|
<h2>Create Zone</h2>
|
|
344
|
-
<p style="color: #888; margin-bottom: 15px; font-size: 13px;">Click points on the canvas to draw a polygon.
|
|
346
|
+
<p style="color: #888; margin-bottom: 15px; font-size: 13px;">Click points on the canvas to draw a polygon. Click "Finish Zone" button or press Enter to complete.</p>
|
|
345
347
|
<div class="form-group">
|
|
346
348
|
<label>Zone Name</label>
|
|
347
349
|
<input type="text" id="zone-name-input" placeholder="e.g., Front Yard">
|
|
@@ -404,6 +406,8 @@ export const EDITOR_HTML = `<!DOCTYPE html>
|
|
|
404
406
|
let zoneDrawingMode = false;
|
|
405
407
|
let currentZonePoints = [];
|
|
406
408
|
let pendingZoneConfig = null;
|
|
409
|
+
let lastClickTime = 0;
|
|
410
|
+
const DOUBLE_CLICK_THRESHOLD = 400; // ms
|
|
407
411
|
|
|
408
412
|
// Zone colors by type
|
|
409
413
|
const ZONE_COLORS = {
|
|
@@ -1106,7 +1110,7 @@ export const EDITOR_HTML = `<!DOCTYPE html>
|
|
|
1106
1110
|
ctx.fillStyle = '#fff';
|
|
1107
1111
|
ctx.font = 'bold 12px sans-serif';
|
|
1108
1112
|
ctx.textAlign = 'left';
|
|
1109
|
-
ctx.fillText('Click to add points.
|
|
1113
|
+
ctx.fillText('Click to add points. Click "Finish Zone" button or press Enter to complete. Esc to cancel.', 10, canvas.height - 10);
|
|
1110
1114
|
}
|
|
1111
1115
|
|
|
1112
1116
|
// Draw landmarks first (below cameras and connections)
|
|
@@ -1756,9 +1760,14 @@ export const EDITOR_HTML = `<!DOCTYPE html>
|
|
|
1756
1760
|
pendingZoneConfig = { name, type, description };
|
|
1757
1761
|
zoneDrawingMode = true;
|
|
1758
1762
|
currentZonePoints = [];
|
|
1763
|
+
lastClickTime = 0;
|
|
1759
1764
|
closeModal('add-zone-modal');
|
|
1760
|
-
setStatus('Zone drawing mode - click to add points,
|
|
1765
|
+
setStatus('Zone drawing mode - click to add points, click Finish Zone when done', 'warning');
|
|
1766
|
+
// Show zone drawing buttons
|
|
1767
|
+
document.getElementById('finish-zone-btn').style.display = 'inline-block';
|
|
1768
|
+
document.getElementById('cancel-zone-btn').style.display = 'inline-block';
|
|
1761
1769
|
render();
|
|
1770
|
+
console.log('[Zone] Drawing mode started for:', name);
|
|
1762
1771
|
}
|
|
1763
1772
|
|
|
1764
1773
|
function cancelZoneDrawing() {
|
|
@@ -1766,9 +1775,13 @@ export const EDITOR_HTML = `<!DOCTYPE html>
|
|
|
1766
1775
|
currentZonePoints = [];
|
|
1767
1776
|
pendingZoneConfig = null;
|
|
1768
1777
|
closeModal('add-zone-modal');
|
|
1778
|
+
// Hide zone drawing buttons
|
|
1779
|
+
document.getElementById('finish-zone-btn').style.display = 'none';
|
|
1780
|
+
document.getElementById('cancel-zone-btn').style.display = 'none';
|
|
1769
1781
|
setTool('select');
|
|
1770
1782
|
setStatus('Zone drawing cancelled', 'success');
|
|
1771
1783
|
render();
|
|
1784
|
+
console.log('[Zone] Drawing mode cancelled');
|
|
1772
1785
|
}
|
|
1773
1786
|
|
|
1774
1787
|
function finishZoneDrawing() {
|
|
@@ -1803,6 +1816,10 @@ export const EDITOR_HTML = `<!DOCTYPE html>
|
|
|
1803
1816
|
currentZonePoints = [];
|
|
1804
1817
|
pendingZoneConfig = null;
|
|
1805
1818
|
|
|
1819
|
+
// Hide zone drawing buttons
|
|
1820
|
+
document.getElementById('finish-zone-btn').style.display = 'none';
|
|
1821
|
+
document.getElementById('cancel-zone-btn').style.display = 'none';
|
|
1822
|
+
|
|
1806
1823
|
setTool('select');
|
|
1807
1824
|
updateUI();
|
|
1808
1825
|
render();
|
|
@@ -1904,9 +1921,21 @@ export const EDITOR_HTML = `<!DOCTYPE html>
|
|
|
1904
1921
|
|
|
1905
1922
|
// Handle zone drawing mode separately
|
|
1906
1923
|
if (zoneDrawingMode) {
|
|
1924
|
+
const now = Date.now();
|
|
1925
|
+
const timeSinceLastClick = now - lastClickTime;
|
|
1926
|
+
lastClickTime = now;
|
|
1927
|
+
|
|
1928
|
+
// If this is the second click of a double-click, don't add a point
|
|
1929
|
+
// The dblclick event will handle finishing the zone
|
|
1930
|
+
if (timeSinceLastClick < DOUBLE_CLICK_THRESHOLD && currentZonePoints.length >= 3) {
|
|
1931
|
+
console.log('[Zone] Double-click detected, skipping point addition');
|
|
1932
|
+
return;
|
|
1933
|
+
}
|
|
1934
|
+
|
|
1907
1935
|
currentZonePoints.push({ x, y });
|
|
1936
|
+
console.log('[Zone] Added point', currentZonePoints.length, 'at', x, y);
|
|
1908
1937
|
render();
|
|
1909
|
-
setStatus('Point ' + currentZonePoints.length + ' added. ' + (currentZonePoints.length < 3 ? 'Need at least 3 points.' : '
|
|
1938
|
+
setStatus('Point ' + currentZonePoints.length + ' added. ' + (currentZonePoints.length < 3 ? 'Need at least 3 points.' : 'Click Finish Zone to complete.'), 'warning');
|
|
1910
1939
|
return;
|
|
1911
1940
|
}
|
|
1912
1941
|
|
|
@@ -1964,7 +1993,9 @@ export const EDITOR_HTML = `<!DOCTYPE html>
|
|
|
1964
1993
|
|
|
1965
1994
|
// Double-click to finish zone drawing
|
|
1966
1995
|
canvas.addEventListener('dblclick', (e) => {
|
|
1996
|
+
console.log('[Zone] dblclick event, zoneDrawingMode:', zoneDrawingMode, 'points:', currentZonePoints.length);
|
|
1967
1997
|
if (zoneDrawingMode && currentZonePoints.length >= 3) {
|
|
1998
|
+
console.log('[Zone] Calling finishZoneDrawing from dblclick');
|
|
1968
1999
|
finishZoneDrawing();
|
|
1969
2000
|
}
|
|
1970
2001
|
});
|