MCPcopy Create free account
hub / github.com/Moddable-OpenSource/moddable / union

Method union

examples/commodetto/mini-drag/main.js:52–78  ·  view source on GitHub ↗
(r1, r2)

Source from the content-addressed store, hash-verified

50 return false;
51 }
52 static union(r1, r2) {
53 let r = new Rectangle();
54 if (r1.x > r2.x)
55 r.x = r2.x;
56 else
57 r.x = r1.x;
58
59 if (r1.y > r2.y)
60 r.y = r2.y;
61 else
62 r.y = r1.y;
63
64 let v1 = r1.x + r1.w;
65 let v2 = r2.x + r2.w;
66 if (v1 > v2)
67 r.w = v1 - r.x;
68 else
69 r.w = v2 - r.x;
70
71 v1 = r1.y + r1.h;
72 v2 = r2.y + r2.h;
73 if (v1 > v2)
74 r.h = v1 - r.y;
75 else
76 r.h = v2 - r.y;
77 return r;
78 }
79}
80
81class Dragger {

Callers 1

onTouchMovedMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected