feat(dashboard): add lock button to prevent accidental widget movement
- Add lock/unlock button to dashboard header (always visible) - Lock state prevents dragging in both normal and edit modes - Lock state prevents resizing in edit mode - Icon changes: lock-open (unlocked) ↔ lock (locked) - Hide resize handles and prevent grab cursor when locked - Lock state persists across edit mode toggles - Integrate lock checks in DragDropHandler and ResizeHandler - Pass editManager reference to drag/resize handlers for lock state access
This commit is contained in:
@@ -27,6 +27,7 @@ export class ResizeHandler {
|
||||
*/
|
||||
constructor(gridEngine, options = {}) {
|
||||
this.gridEngine = gridEngine;
|
||||
this.editManager = options.editManager || null; // Reference to EditModeManager for lock state
|
||||
this.options = {
|
||||
showDimensions: true,
|
||||
showGrid: true,
|
||||
@@ -92,12 +93,20 @@ export class ResizeHandler {
|
||||
|
||||
const mouseDownHandler = (e) => {
|
||||
if (e.button !== 0) return;
|
||||
// Don't resize if widgets are locked
|
||||
if (this.editManager?.isWidgetsLocked()) {
|
||||
return;
|
||||
}
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
this.startResize(e, handleType, element, widget, onResizeEnd, widgetConstraints);
|
||||
};
|
||||
|
||||
const touchStartHandler = (e) => {
|
||||
// Don't resize if widgets are locked
|
||||
if (this.editManager?.isWidgetsLocked()) {
|
||||
return;
|
||||
}
|
||||
this.touchTimer = setTimeout(() => {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
|
||||
Reference in New Issue
Block a user