MCPcopy Create free account
hub / github.com/cifertech/DisplayKit / bindNumeric

Function bindNumeric

app.js:6457–6481  ·  view source on GitHub ↗
(input, key)

Source from the content-addressed store, hash-verified

6455
6456
6457function bindNumeric(input, key) {
6458 input.addEventListener("input", () => {
6459 const el = elements.find((el) => el.id === selectedId);
6460 if (!el) return;
6461 if ((el.type === "image" || el.type === "icon") && (key === "w" || key === "h")) {
6462 input.value = el[key];
6463 return;
6464 }
6465 let v = parseInt(input.value, 10);
6466 if (isNaN(v)) v = 0;
6467 if (snapToGrid && (key === "x" || key === "y") && gridSize > 0) {
6468 v = Math.round(v / gridSize) * gridSize;
6469 }
6470 el[key] = v;
6471 renderElements();
6472 renderLayers();
6473 updateCode();
6474 pushHistory();
6475
6476 // If user resized an icon via inputs, recompute the bitmap for code export
6477 if (el.type === "icon" && (key === "w" || key === "h")) {
6478 scheduleRecomputeSelectedIcon();
6479 }
6480 });
6481}
6482
6483/** Drag numeric labels horizontally to scrub values (Figma-like). */
6484function bindScrubLabel(labelEl, inputEl, opts) {

Callers 1

app.jsFile · 0.85

Calls 4

renderElementsFunction · 0.85
renderLayersFunction · 0.85
updateCodeFunction · 0.85
pushHistoryFunction · 0.85

Tested by

no test coverage detected