MCPcopy Index your code
hub / github.com/cifertech/DisplayKit / onRotMove

Function onRotMove

app.js:4493–4511  ·  view source on GitHub ↗
(e)

Source from the content-addressed store, hash-verified

4491 });
4492
4493 function onRotMove(e) {
4494 if (!rotating) return;
4495 const el = elements.find((x) => x.id === elementId);
4496 if (!el || el.locked || el.hidden) return;
4497 const cx = el.x + el.w / 2;
4498 const cy = el.y + el.h / 2;
4499 const p = clientToArtboardPx(e.clientX, e.clientY);
4500 const a1 = Math.atan2(p.y - cy, p.x - cx) * (180 / Math.PI);
4501 let delta = a1 - startAngleDeg;
4502 while (delta > 180) delta -= 360;
4503 while (delta < -180) delta += 360;
4504 let rot = startRot + delta;
4505 if (e.shiftKey) rot = Math.round(rot / 15) * 15;
4506 el.rotation = Math.round(rot);
4507 updatePropsInputs(false);
4508 renderElements();
4509 renderLayers();
4510 updateCode();
4511 }
4512
4513 function onRotUp() {
4514 if (rotating) pushHistory();

Callers

nothing calls this directly

Calls 5

clientToArtboardPxFunction · 0.85
updatePropsInputsFunction · 0.85
renderElementsFunction · 0.85
renderLayersFunction · 0.85
updateCodeFunction · 0.85

Tested by

no test coverage detected