Skip to content

Commit 45a40c3

Browse files
committed
[DAPS-14xx] Zoom
1 parent cfddbe8 commit 45a40c3

File tree

4 files changed

+149
-134
lines changed

4 files changed

+149
-134
lines changed

web/static/components/provenance/customization_modal.js

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ function showCustomizationModal(node, x, y, currentCustomizationNode) {
66

77
// Set the current node being customized
88
currentCustomizationNode = node;
9-
9+
1010
// Save original values for reverting if cancelled
1111
if (window.saveOriginalValues) {
1212
window.saveOriginalValues(node);
@@ -15,9 +15,7 @@ function showCustomizationModal(node, x, y, currentCustomizationNode) {
1515
const nodeColorInput = document.getElementById("node-color-input");
1616
// Helper function to convert RGB to hex format
1717
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("");
2119
};
2220

2321
// Helper function to get the default color from CSS
@@ -26,7 +24,7 @@ function showCustomizationModal(node, x, y, currentCustomizationNode) {
2624
if (!nodeElement) {
2725
return DEFAULTS.NODE_COLOR;
2826
}
29-
27+
3028
const computedStyle = window.getComputedStyle(nodeElement);
3129
const fillColor = computedStyle.fill;
3230

@@ -72,30 +70,30 @@ function showCustomizationModal(node, x, y, currentCustomizationNode) {
7270
function makeModalDraggable(modal) {
7371
let offsetX, offsetY;
7472
const header = modal.querySelector(".modal-header") || modal;
75-
73+
7674
// Handle mouse movement during drag
7775
function handleMouseMove(e) {
7876
modal.style.left = `${e.clientX - offsetX}px`;
7977
modal.style.top = `${e.clientY - offsetY}px`;
8078
}
81-
79+
8280
// Handle end of drag operation
8381
function handleMouseUp() {
8482
// Remove event listeners when dragging ends to improve performance
8583
document.removeEventListener("mousemove", handleMouseMove);
8684
document.removeEventListener("mouseup", handleMouseUp);
8785
}
88-
86+
8987
// Start dragging when mousedown on header
90-
header.addEventListener("mousedown", function(e) {
88+
header.addEventListener("mousedown", function (e) {
9189
// Calculate initial offset
9290
offsetX = e.clientX - modal.offsetLeft;
9391
offsetY = e.clientY - modal.offsetTop;
94-
92+
9593
// Add event listeners for dragging only when needed
9694
document.addEventListener("mousemove", handleMouseMove);
9795
document.addEventListener("mouseup", handleMouseUp);
98-
96+
9997
e.preventDefault();
10098
});
10199
}
@@ -191,19 +189,19 @@ function createCustomizationModal() {
191189
// Anchor controls
192190
const anchorSection = document.createElement("div");
193191
anchorSection.className = "section";
194-
192+
195193
const anchorRow = document.createElement("div");
196194
anchorRow.className = "control-row checkbox-row";
197-
195+
198196
const anchorCheckbox = document.createElement("input");
199197
anchorCheckbox.type = "checkbox";
200198
anchorCheckbox.id = "anchor-checkbox";
201-
199+
202200
const anchorLabel = document.createElement("label");
203201
anchorLabel.htmlFor = "anchor-checkbox";
204202
anchorLabel.textContent = "Anchor Node";
205203
anchorLabel.classList.add("inline-label");
206-
204+
207205
anchorRow.appendChild(anchorCheckbox);
208206
anchorRow.appendChild(anchorLabel);
209207
anchorSection.appendChild(anchorRow);

0 commit comments

Comments
 (0)