@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/plugin.zip CHANGED
Binary file
@@ -42287,6 +42287,8 @@ exports.EDITOR_HTML = `<!DOCTYPE html>
42287
42287
  <button class="btn" id="tool-wall" onclick="setTool('wall')">Draw Wall</button>
42288
42288
  <button class="btn" id="tool-room" onclick="setTool('room')">Draw Room</button>
42289
42289
  <button class="btn" id="tool-zone" onclick="setTool('zone')" style="background: #2e7d32;">Draw Zone</button>
42290
+ <button class="btn" id="finish-zone-btn" onclick="finishZoneDrawing()" style="background: #1976d2; display: none;">Finish Zone</button>
42291
+ <button class="btn" id="cancel-zone-btn" onclick="cancelZoneDrawing()" style="background: #dc2626; display: none;">Cancel Zone</button>
42290
42292
  <button class="btn" id="tool-camera" onclick="setTool('camera')">Place Camera</button>
42291
42293
  <button class="btn" id="tool-landmark" onclick="setTool('landmark')">Place Landmark</button>
42292
42294
  <button class="btn" id="tool-connect" onclick="setTool('connect')">Connect</button>
@@ -42461,7 +42463,7 @@ exports.EDITOR_HTML = `<!DOCTYPE html>
42461
42463
  <div class="modal-overlay" id="add-zone-modal">
42462
42464
  <div class="modal">
42463
42465
  <h2>Create Zone</h2>
42464
- <p style="color: #888; margin-bottom: 15px; font-size: 13px;">Click points on the canvas to draw a polygon. Double-click or press Enter to finish.</p>
42466
+ <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>
42465
42467
  <div class="form-group">
42466
42468
  <label>Zone Name</label>
42467
42469
  <input type="text" id="zone-name-input" placeholder="e.g., Front Yard">
@@ -42524,6 +42526,8 @@ exports.EDITOR_HTML = `<!DOCTYPE html>
42524
42526
  let zoneDrawingMode = false;
42525
42527
  let currentZonePoints = [];
42526
42528
  let pendingZoneConfig = null;
42529
+ let lastClickTime = 0;
42530
+ const DOUBLE_CLICK_THRESHOLD = 400; // ms
42527
42531
 
42528
42532
  // Zone colors by type
42529
42533
  const ZONE_COLORS = {
@@ -43226,7 +43230,7 @@ exports.EDITOR_HTML = `<!DOCTYPE html>
43226
43230
  ctx.fillStyle = '#fff';
43227
43231
  ctx.font = 'bold 12px sans-serif';
43228
43232
  ctx.textAlign = 'left';
43229
- ctx.fillText('Click to add points. Double-click or press Enter to finish. Esc to cancel.', 10, canvas.height - 10);
43233
+ ctx.fillText('Click to add points. Click "Finish Zone" button or press Enter to complete. Esc to cancel.', 10, canvas.height - 10);
43230
43234
  }
43231
43235
 
43232
43236
  // Draw landmarks first (below cameras and connections)
@@ -43876,9 +43880,14 @@ exports.EDITOR_HTML = `<!DOCTYPE html>
43876
43880
  pendingZoneConfig = { name, type, description };
43877
43881
  zoneDrawingMode = true;
43878
43882
  currentZonePoints = [];
43883
+ lastClickTime = 0;
43879
43884
  closeModal('add-zone-modal');
43880
- setStatus('Zone drawing mode - click to add points, double-click to finish', 'warning');
43885
+ setStatus('Zone drawing mode - click to add points, click Finish Zone when done', 'warning');
43886
+ // Show zone drawing buttons
43887
+ document.getElementById('finish-zone-btn').style.display = 'inline-block';
43888
+ document.getElementById('cancel-zone-btn').style.display = 'inline-block';
43881
43889
  render();
43890
+ console.log('[Zone] Drawing mode started for:', name);
43882
43891
  }
43883
43892
 
43884
43893
  function cancelZoneDrawing() {
@@ -43886,9 +43895,13 @@ exports.EDITOR_HTML = `<!DOCTYPE html>
43886
43895
  currentZonePoints = [];
43887
43896
  pendingZoneConfig = null;
43888
43897
  closeModal('add-zone-modal');
43898
+ // Hide zone drawing buttons
43899
+ document.getElementById('finish-zone-btn').style.display = 'none';
43900
+ document.getElementById('cancel-zone-btn').style.display = 'none';
43889
43901
  setTool('select');
43890
43902
  setStatus('Zone drawing cancelled', 'success');
43891
43903
  render();
43904
+ console.log('[Zone] Drawing mode cancelled');
43892
43905
  }
43893
43906
 
43894
43907
  function finishZoneDrawing() {
@@ -43923,6 +43936,10 @@ exports.EDITOR_HTML = `<!DOCTYPE html>
43923
43936
  currentZonePoints = [];
43924
43937
  pendingZoneConfig = null;
43925
43938
 
43939
+ // Hide zone drawing buttons
43940
+ document.getElementById('finish-zone-btn').style.display = 'none';
43941
+ document.getElementById('cancel-zone-btn').style.display = 'none';
43942
+
43926
43943
  setTool('select');
43927
43944
  updateUI();
43928
43945
  render();
@@ -44024,9 +44041,21 @@ exports.EDITOR_HTML = `<!DOCTYPE html>
44024
44041
 
44025
44042
  // Handle zone drawing mode separately
44026
44043
  if (zoneDrawingMode) {
44044
+ const now = Date.now();
44045
+ const timeSinceLastClick = now - lastClickTime;
44046
+ lastClickTime = now;
44047
+
44048
+ // If this is the second click of a double-click, don't add a point
44049
+ // The dblclick event will handle finishing the zone
44050
+ if (timeSinceLastClick < DOUBLE_CLICK_THRESHOLD && currentZonePoints.length >= 3) {
44051
+ console.log('[Zone] Double-click detected, skipping point addition');
44052
+ return;
44053
+ }
44054
+
44027
44055
  currentZonePoints.push({ x, y });
44056
+ console.log('[Zone] Added point', currentZonePoints.length, 'at', x, y);
44028
44057
  render();
44029
- setStatus('Point ' + currentZonePoints.length + ' added. ' + (currentZonePoints.length < 3 ? 'Need at least 3 points.' : 'Double-click or Enter to finish.'), 'warning');
44058
+ setStatus('Point ' + currentZonePoints.length + ' added. ' + (currentZonePoints.length < 3 ? 'Need at least 3 points.' : 'Click Finish Zone to complete.'), 'warning');
44030
44059
  return;
44031
44060
  }
44032
44061
 
@@ -44084,7 +44113,9 @@ exports.EDITOR_HTML = `<!DOCTYPE html>
44084
44113
 
44085
44114
  // Double-click to finish zone drawing
44086
44115
  canvas.addEventListener('dblclick', (e) => {
44116
+ console.log('[Zone] dblclick event, zoneDrawingMode:', zoneDrawingMode, 'points:', currentZonePoints.length);
44087
44117
  if (zoneDrawingMode && currentZonePoints.length >= 3) {
44118
+ console.log('[Zone] Calling finishZoneDrawing from dblclick');
44088
44119
  finishZoneDrawing();
44089
44120
  }
44090
44121
  });