MCPcopy
hub / github.com/konvajs/konva / getTrace

Method getTrace

src/Context.ts:205–248  ·  view source on GitHub ↗
(relaxed?: boolean, rounded?: boolean)

Source from the content-addressed store, hash-verified

203 }
204
205 getTrace(relaxed?: boolean, rounded?: boolean) {
206 let traceArr = this.traceArr,
207 len = traceArr.length,
208 str = '',
209 n,
210 trace,
211 method,
212 args;
213
214 for (n = 0; n < len; n++) {
215 trace = traceArr[n];
216 method = trace.method;
217
218 // methods
219 if (method) {
220 args = trace.args;
221 str += method;
222 if (relaxed) {
223 str += DOUBLE_PAREN;
224 } else {
225 if (Util._isArray(args[0])) {
226 str += OPEN_PAREN_BRACKET + args.join(COMMA) + CLOSE_BRACKET_PAREN;
227 } else {
228 if (rounded) {
229 args = args.map((a) =>
230 typeof a === 'number' ? Math.floor(a) : a
231 );
232 }
233 str += OPEN_PAREN + args.join(COMMA) + CLOSE_PAREN;
234 }
235 }
236 } else {
237 // properties
238 str += trace.property;
239 if (!relaxed) {
240 str += EQUALS + trace.val;
241 }
242 }
243
244 str += SEMICOLON;
245 }
246
247 return str;
248 }
249
250 clearTrace() {
251 this.traceArr = [];

Callers 15

Image-test.tsFile · 0.80
Arc-test.tsFile · 0.80
Node-test.tsFile · 0.80
Path-test.tsFile · 0.80
Ring-test.tsFile · 0.80
Spline-test.tsFile · 0.80
TextPath-test.tsFile · 0.80
Arrow-test.tsFile · 0.80
Shape-test.tsFile · 0.80
Line-test.tsFile · 0.80
Sprite-test.tsFile · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected