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

Function getSelectionBoundsPx

app.js:5001–5012  ·  view source on GitHub ↗
(ids)

Source from the content-addressed store, hash-verified

4999}
5000
5001function getSelectionBoundsPx(ids) {
5002 const sels = (ids && ids.length ? ids : (selectedIds && selectedIds.size ? Array.from(selectedIds) : [])).map((id) => elements.find((e) => e.id === id)).filter(Boolean);
5003 if (!sels.length) return null;
5004 let minX = Infinity, minY = Infinity, maxX = -Infinity, maxY = -Infinity;
5005 sels.forEach((el) => {
5006 minX = Math.min(minX, el.x);
5007 minY = Math.min(minY, el.y);
5008 maxX = Math.max(maxX, el.x + el.w);
5009 maxY = Math.max(maxY, el.y + el.h);
5010 });
5011 return { x: minX, y: minY, w: Math.max(1, maxX - minX), h: Math.max(1, maxY - minY) };
5012}
5013
5014function groupSelection() {
5015 const sels = getSelectedElements().filter((s) => !s.locked && !s.hidden);

Callers 1

renderElementsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected