MCPcopy Create free account
hub / github.com/alignoth/alignoth / dS

Function dS

resources/vega.min.js:26055–26142  ·  view source on GitHub ↗
(t, e, n, r)

Source from the content-addressed store, hash-verified

26053 );
26054 }
26055 function dS(t, e, n, r) {
26056 if (!e.sprite) {
26057 var i = t.context,
26058 o = t.ratio;
26059 i.clearRect(0, 0, (cS << 5) / o, fS / o);
26060 var a,
26061 s,
26062 u,
26063 l,
26064 c,
26065 f = 0,
26066 h = 0,
26067 d = 0,
26068 p = n.length;
26069 for (--r; ++r < p; ) {
26070 if (
26071 ((e = n[r]),
26072 i.save(),
26073 (i.font =
26074 e.style +
26075 " " +
26076 e.weight +
26077 " " +
26078 ~~((e.size + 1) / o) +
26079 "px " +
26080 e.font),
26081 (a = i.measureText(e.text + "m").width * o),
26082 (u = e.size << 1),
26083 e.rotate)
26084 ) {
26085 var g = Math.sin(e.rotate * lS),
26086 m = Math.cos(e.rotate * lS),
26087 y = a * m,
26088 v = a * g,
26089 _ = u * m,
26090 x = u * g;
26091 ((a = ((Math.max(Math.abs(y + x), Math.abs(y - x)) + 31) >> 5) << 5),
26092 (u = ~~Math.max(Math.abs(v + _), Math.abs(v - _))));
26093 } else a = ((a + 31) >> 5) << 5;
26094 if (
26095 (u > d && (d = u),
26096 f + a >= cS << 5 && ((f = 0), (h += d), (d = 0)),
26097 h + u >= fS)
26098 )
26099 break;
26100 (i.translate((f + (a >> 1)) / o, (h + (u >> 1)) / o),
26101 e.rotate && i.rotate(e.rotate * lS),
26102 i.fillText(e.text, 0, 0),
26103 e.padding &&
26104 ((i.lineWidth = 2 * e.padding), i.strokeText(e.text, 0, 0)),
26105 i.restore(),
26106 (e.width = a),
26107 (e.height = u),
26108 (e.xoff = f),
26109 (e.yoff = h),
26110 (e.x1 = a >> 1),
26111 (e.y1 = u >> 1),
26112 (e.x0 = -e.x1),

Callers 1

hSFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected