MCPcopy Create free account
hub / github.com/TeleBoxOrg/TeleBox_Plugins / overlaps

Function overlaps

cy/cy.ts:249–262  ·  view source on GitHub ↗
(a: WordItem, placed: WordItem[])

Source from the content-addressed store, hash-verified

247 });
248}
249
250function overlaps(a: WordItem, placed: WordItem[]): boolean {
251 const padding = 4;
252 const ax1 = (a.x || 0) - padding;
253 const ay1 = (a.y || 0) - (a.height || 0) - padding;
254 const ax2 = (a.x || 0) + (a.width || 0) + padding;
255 const ay2 = (a.y || 0) + padding;
256 return placed.some((b) => {
257 const bx1 = (b.x || 0) - padding;
258 const by1 = (b.y || 0) - (b.height || 0) - padding;
259 const bx2 = (b.x || 0) + (b.width || 0) + padding;
260 const by2 = (b.y || 0) + padding;
261 return ax1 < bx2 && ax2 > bx1 && ay1 < by2 && ay2 > by1;
262 });
263}
264
265function layoutWords(ctx: CanvasContext, words: WordItem[]): WordItem[] {

Callers 1

layoutWordsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected