@@ -6,7 +6,7 @@ function showCustomizationModal(node, x, y, currentCustomizationNode) {
6
6
7
7
// Set the current node being customized
8
8
currentCustomizationNode = node ;
9
-
9
+
10
10
// Save original values for reverting if cancelled
11
11
if ( window . saveOriginalValues ) {
12
12
window . saveOriginalValues ( node ) ;
@@ -15,9 +15,7 @@ function showCustomizationModal(node, x, y, currentCustomizationNode) {
15
15
const nodeColorInput = document . getElementById ( "node-color-input" ) ;
16
16
// Helper function to convert RGB to hex format
17
17
const rgbToHex = ( rgb ) => {
18
- return "#" + rgb
19
- . map ( x => parseInt ( x ) . toString ( 16 ) . padStart ( 2 , "0" ) )
20
- . join ( "" ) ;
18
+ return "#" + rgb . map ( ( x ) => parseInt ( x ) . toString ( 16 ) . padStart ( 2 , "0" ) ) . join ( "" ) ;
21
19
} ;
22
20
23
21
// Helper function to get the default color from CSS
@@ -26,7 +24,7 @@ function showCustomizationModal(node, x, y, currentCustomizationNode) {
26
24
if ( ! nodeElement ) {
27
25
return DEFAULTS . NODE_COLOR ;
28
26
}
29
-
27
+
30
28
const computedStyle = window . getComputedStyle ( nodeElement ) ;
31
29
const fillColor = computedStyle . fill ;
32
30
@@ -72,30 +70,30 @@ function showCustomizationModal(node, x, y, currentCustomizationNode) {
72
70
function makeModalDraggable ( modal ) {
73
71
let offsetX , offsetY ;
74
72
const header = modal . querySelector ( ".modal-header" ) || modal ;
75
-
73
+
76
74
// Handle mouse movement during drag
77
75
function handleMouseMove ( e ) {
78
76
modal . style . left = `${ e . clientX - offsetX } px` ;
79
77
modal . style . top = `${ e . clientY - offsetY } px` ;
80
78
}
81
-
79
+
82
80
// Handle end of drag operation
83
81
function handleMouseUp ( ) {
84
82
// Remove event listeners when dragging ends to improve performance
85
83
document . removeEventListener ( "mousemove" , handleMouseMove ) ;
86
84
document . removeEventListener ( "mouseup" , handleMouseUp ) ;
87
85
}
88
-
86
+
89
87
// Start dragging when mousedown on header
90
- header . addEventListener ( "mousedown" , function ( e ) {
88
+ header . addEventListener ( "mousedown" , function ( e ) {
91
89
// Calculate initial offset
92
90
offsetX = e . clientX - modal . offsetLeft ;
93
91
offsetY = e . clientY - modal . offsetTop ;
94
-
92
+
95
93
// Add event listeners for dragging only when needed
96
94
document . addEventListener ( "mousemove" , handleMouseMove ) ;
97
95
document . addEventListener ( "mouseup" , handleMouseUp ) ;
98
-
96
+
99
97
e . preventDefault ( ) ;
100
98
} ) ;
101
99
}
@@ -191,19 +189,19 @@ function createCustomizationModal() {
191
189
// Anchor controls
192
190
const anchorSection = document . createElement ( "div" ) ;
193
191
anchorSection . className = "section" ;
194
-
192
+
195
193
const anchorRow = document . createElement ( "div" ) ;
196
194
anchorRow . className = "control-row checkbox-row" ;
197
-
195
+
198
196
const anchorCheckbox = document . createElement ( "input" ) ;
199
197
anchorCheckbox . type = "checkbox" ;
200
198
anchorCheckbox . id = "anchor-checkbox" ;
201
-
199
+
202
200
const anchorLabel = document . createElement ( "label" ) ;
203
201
anchorLabel . htmlFor = "anchor-checkbox" ;
204
202
anchorLabel . textContent = "Anchor Node" ;
205
203
anchorLabel . classList . add ( "inline-label" ) ;
206
-
204
+
207
205
anchorRow . appendChild ( anchorCheckbox ) ;
208
206
anchorRow . appendChild ( anchorLabel ) ;
209
207
anchorSection . appendChild ( anchorRow ) ;
0 commit comments