squarified 0.6.0 → 0.6.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/plugin.js ADDED
@@ -0,0 +1,662 @@
1
+ 'use strict';
2
+
3
+ var domEvent = require('./dom-event-ClwTQnot.js');
4
+
5
+ // Currently, etoile is an internal module, so we won't need too much easing functions.
6
+ // And the animation logic is implemented by user code.
7
+ const easing = {
8
+ linear: (k)=>k,
9
+ quadraticIn: (k)=>k * k,
10
+ quadraticOut: (k)=>k * (2 - k),
11
+ quadraticInOut: (k)=>{
12
+ if ((k *= 2) < 1) {
13
+ return 0.5 * k * k;
14
+ }
15
+ return -0.5 * (--k * (k - 2) - 1);
16
+ },
17
+ cubicIn: (k)=>k * k * k,
18
+ cubicOut: (k)=>{
19
+ if ((k *= 2) < 1) {
20
+ return 0.5 * k * k * k;
21
+ }
22
+ return 0.5 * ((k -= 2) * k * k + 2);
23
+ },
24
+ cubicInOut: (k)=>{
25
+ if ((k *= 2) < 1) {
26
+ return 0.5 * k * k * k;
27
+ }
28
+ return 0.5 * ((k -= 2) * k * k + 2);
29
+ }
30
+ };
31
+
32
+ class Highlight extends domEvent.Schedule {
33
+ reset() {
34
+ this.destory();
35
+ this.update();
36
+ }
37
+ get canvas() {
38
+ return this.render.canvas;
39
+ }
40
+ setZIndexForHighlight(zIndex = '-1') {
41
+ this.canvas.style.zIndex = zIndex;
42
+ }
43
+ init() {
44
+ this.setZIndexForHighlight();
45
+ this.canvas.style.position = 'absolute';
46
+ this.canvas.style.pointerEvents = 'none';
47
+ }
48
+ }
49
+ const ANIMATION_DURATION = 300;
50
+ const HIGH_LIGHT_OPACITY = 0.3;
51
+ const fill = {
52
+ desc: {
53
+ r: 255,
54
+ g: 255,
55
+ b: 255
56
+ },
57
+ mode: 'rgb'
58
+ };
59
+ const presetHighlightPlugin = domEvent.definePlugin({
60
+ name: 'treemap:preset-highlight',
61
+ onLoad () {
62
+ const meta = this.getPluginMetadata('treemap:preset-highlight');
63
+ if (!meta) {
64
+ return;
65
+ }
66
+ if (!meta.highlight) {
67
+ meta.highlight = new Highlight(this.instance.to);
68
+ }
69
+ },
70
+ onDOMEventTriggered (name, _, module, { stateManager: state, matrix }) {
71
+ if (name === 'mousemove') {
72
+ if (state.canTransition('MOVE')) {
73
+ const meta = this.getPluginMetadata('treemap:preset-highlight');
74
+ if (!module) {
75
+ meta.highlight?.reset();
76
+ meta.highlight?.update();
77
+ meta.highlight?.setZIndexForHighlight();
78
+ return;
79
+ }
80
+ const [x, y, w, h] = module.layout;
81
+ const effectiveRadius = Math.min(module.config.rectRadius, w / 4, h / 4);
82
+ domEvent.smoothFrame((_, cleanup)=>{
83
+ cleanup();
84
+ meta.highlight?.reset();
85
+ const mask = domEvent.createRoundBlock(x, y, w, h, {
86
+ fill,
87
+ opacity: HIGH_LIGHT_OPACITY,
88
+ radius: effectiveRadius,
89
+ padding: 0
90
+ });
91
+ meta.highlight?.add(mask);
92
+ meta.highlight?.setZIndexForHighlight('1');
93
+ domEvent.stackMatrixTransform(mask, matrix.e, matrix.f, 1);
94
+ meta.highlight?.update();
95
+ }, {
96
+ duration: ANIMATION_DURATION
97
+ });
98
+ }
99
+ }
100
+ },
101
+ onResize () {
102
+ const meta = this.getPluginMetadata('treemap:preset-highlight');
103
+ if (!meta) {
104
+ return;
105
+ }
106
+ meta.highlight?.render.initOptions({
107
+ ...this.instance.render.options
108
+ });
109
+ meta.highlight?.reset();
110
+ meta.highlight?.init();
111
+ },
112
+ onDispose () {
113
+ const meta = this.getPluginMetadata('treemap:preset-highlight');
114
+ if (meta && meta.highlight) {
115
+ meta.highlight.destory();
116
+ meta.highlight = null;
117
+ }
118
+ },
119
+ meta: {
120
+ highlight: null
121
+ }
122
+ });
123
+
124
+ const presetDragElementPlugin = domEvent.definePlugin({
125
+ name: 'treemap:preset-drag-element',
126
+ onDOMEventTriggered (name, event, module, domEvent$1) {
127
+ const { stateManager: state, matrix, component } = domEvent$1;
128
+ switch(name){
129
+ case 'mousemove':
130
+ {
131
+ if (state.isInState('DRAGGING')) {
132
+ domEvent$1.silent('click');
133
+ } else {
134
+ domEvent$1.active('click');
135
+ }
136
+ const meta = getDragOptions.call(this);
137
+ if (!meta) {
138
+ return;
139
+ }
140
+ if (meta.dragOptions.x === 0 && meta.dragOptions.y === 0) {
141
+ state.transition('IDLE');
142
+ return;
143
+ }
144
+ state.transition('DRAGGING');
145
+ if (state.isInState('DRAGGING')) {
146
+ const highlight = getHighlightInstance.call(this);
147
+ domEvent.smoothFrame((_, cleanup)=>{
148
+ cleanup();
149
+ const { offsetX, offsetY } = event.native;
150
+ const drawX = offsetX - meta.dragOptions.x;
151
+ const drawY = offsetY - meta.dragOptions.y;
152
+ const lastX = meta.dragOptions.x;
153
+ const lastY = meta.dragOptions.y;
154
+ if (highlight?.highlight) {
155
+ highlight.highlight.reset();
156
+ highlight.highlight.setZIndexForHighlight();
157
+ }
158
+ matrix.translation(drawX, drawY);
159
+ meta.dragOptions.x = offsetX;
160
+ meta.dragOptions.y = offsetY;
161
+ meta.dragOptions.lastX = lastX;
162
+ meta.dragOptions.lastY = lastY;
163
+ component.cleanup();
164
+ component.draw(false, false);
165
+ domEvent.stackMatrixTransformWithGraphAndLayer(component.elements, matrix.e, matrix.f, 1);
166
+ component.update();
167
+ return true;
168
+ }, {
169
+ duration: ANIMATION_DURATION,
170
+ deps: [
171
+ ()=>state.isInState('IDLE')
172
+ ]
173
+ });
174
+ }
175
+ break;
176
+ }
177
+ case 'mouseup':
178
+ {
179
+ if (state.isInState('PRESSED')) {
180
+ const meta = getDragOptions.call(this);
181
+ if (meta && meta.dragOptions) {
182
+ if (meta.dragOptions.x === meta.dragOptions.lastX && meta.dragOptions.y === meta.dragOptions.lastY) {
183
+ state.transition('IDLE');
184
+ return;
185
+ }
186
+ }
187
+ }
188
+ if (state.isInState('DRAGGING') && state.canTransition('IDLE')) {
189
+ const highlight = getHighlightInstance.call(this);
190
+ if (highlight && highlight.highlight) {
191
+ highlight.highlight.reset();
192
+ highlight.highlight.setZIndexForHighlight();
193
+ }
194
+ const meta = getDragOptions.call(this);
195
+ if (meta && meta.dragOptions) {
196
+ meta.dragOptions.x = 0;
197
+ meta.dragOptions.y = 0;
198
+ meta.dragOptions.lastX = 0;
199
+ meta.dragOptions.lastY = 0;
200
+ state.transition('IDLE');
201
+ }
202
+ }
203
+ break;
204
+ }
205
+ case 'mousedown':
206
+ {
207
+ if (domEvent.isScrollWheelOrRightButtonOnMouseupAndDown(event.native)) {
208
+ return;
209
+ }
210
+ const meta = getDragOptions.call(this);
211
+ if (!meta) {
212
+ return;
213
+ }
214
+ meta.dragOptions.x = event.native.offsetX;
215
+ meta.dragOptions.y = event.native.offsetY;
216
+ meta.dragOptions.lastX = event.native.offsetX;
217
+ meta.dragOptions.lastY = event.native.offsetY;
218
+ state.transition('PRESSED');
219
+ break;
220
+ }
221
+ }
222
+ },
223
+ meta: {
224
+ dragOptions: {
225
+ x: 0,
226
+ y: 0,
227
+ lastX: 0,
228
+ lastY: 0
229
+ }
230
+ },
231
+ onResize ({ matrix, stateManager: state }) {
232
+ matrix.create(domEvent.DEFAULT_MATRIX_LOC);
233
+ state.reset();
234
+ }
235
+ });
236
+ function getHighlightInstance() {
237
+ return this.getPluginMetadata('treemap:preset-highlight');
238
+ }
239
+ function getDragOptions() {
240
+ const meta = this.getPluginMetadata('treemap:preset-drag-element');
241
+ return meta;
242
+ }
243
+
244
+ function presetMenuPlugin(options) {
245
+ let menu = null;
246
+ let domEvent$1 = null;
247
+ const handleMenuClick = (e)=>{
248
+ if (!domEvent$1) {
249
+ return;
250
+ }
251
+ if (!menu) {
252
+ return;
253
+ }
254
+ const target = e.target;
255
+ if (target.parentNode) {
256
+ const parent = target.parentNode;
257
+ const action = parent.getAttribute('data-action');
258
+ if (!action) {
259
+ return;
260
+ }
261
+ if (options?.onClick) {
262
+ options.onClick(action, domEvent$1.findRelativeNode({
263
+ native: e,
264
+ kind: undefined
265
+ }));
266
+ }
267
+ }
268
+ menu.style.display = 'none';
269
+ };
270
+ return domEvent.definePlugin({
271
+ name: 'treemap:preset-menu',
272
+ onDOMEventTriggered (_, event, __, DOMEvent) {
273
+ if (domEvent.isContextMenuEvent(event)) {
274
+ event.native.stopPropagation();
275
+ event.native.preventDefault();
276
+ if (!menu) {
277
+ menu = document.createElement('div');
278
+ domEvent$1 = DOMEvent;
279
+ Object.assign(menu.style, {
280
+ backgroundColor: '#fff',
281
+ ...options?.style,
282
+ position: 'absolute',
283
+ zIndex: '9999'
284
+ });
285
+ menu.addEventListener('click', handleMenuClick);
286
+ if (menu && options?.render) {
287
+ const result = options.render(menu);
288
+ menu.innerHTML = result.map((item)=>{
289
+ return `<div data-action='${item.action}'>${item.html}</div>`;
290
+ }).join('');
291
+ }
292
+ document.body.append(menu);
293
+ }
294
+ menu.style.left = event.native.clientX + 'px';
295
+ menu.style.top = event.native.clientY + 'px';
296
+ menu.style.display = 'initial';
297
+ }
298
+ },
299
+ onDispose () {
300
+ if (!menu) {
301
+ return;
302
+ }
303
+ menu.removeEventListener('click', handleMenuClick);
304
+ menu = null;
305
+ domEvent$1 = null;
306
+ }
307
+ });
308
+ }
309
+
310
+ const presetColorPlugin = domEvent.definePlugin({
311
+ name: 'treemap:preset-color',
312
+ onModuleInit (modules) {
313
+ const colorMappings = {};
314
+ for(let i = 0; i < modules.length; i++){
315
+ const module = modules[i];
316
+ assignColorMappings(colorMappings, module, Math.abs(domEvent.hashCode(module.node.id)) % domEvent.PI_2, 0);
317
+ }
318
+ return {
319
+ colorMappings
320
+ };
321
+ }
322
+ });
323
+ function assignColorMappings(colorMappings, module, ancestorHue, depth) {
324
+ const hueOffset = Math.abs(domEvent.hashCode(module.node.id)) % 60 - 30;
325
+ const hue = (ancestorHue + hueOffset) % 360;
326
+ const saturation = Math.max(75 - depth * 5, 40);
327
+ const baseLightness = 55 - depth * 3;
328
+ const color = adjustColorToComfortableForHumanEye(hue, saturation, baseLightness);
329
+ colorMappings[module.node.id] = color;
330
+ if (module.node.isCombinedNode && module.node.originalNodes) {
331
+ for (const combined of module.node.originalNodes){
332
+ colorMappings[combined.id] = color;
333
+ }
334
+ }
335
+ if (module.children && module.children.length) {
336
+ const childCount = module.children.length;
337
+ for(let i = 0; i < childCount; i++){
338
+ const childHueOffset = 40 * i / childCount;
339
+ const childHue = (hue + childHueOffset) % 360;
340
+ assignColorMappings(colorMappings, module.children[i], childHue, depth + 1);
341
+ }
342
+ }
343
+ }
344
+ function adjustColorToComfortableForHumanEye(hue, saturation, lightness) {
345
+ hue = (hue % 360 + 360) % 360;
346
+ saturation = Math.min(Math.max(saturation, 40), 85);
347
+ lightness = Math.min(Math.max(lightness, 35), 75);
348
+ if (hue >= 60 && hue <= 180) {
349
+ saturation = Math.max(saturation - 10, 40);
350
+ lightness = Math.min(lightness + 5, 75);
351
+ } else if (hue >= 200 && hue <= 280) {
352
+ lightness = Math.min(lightness + 8, 75);
353
+ } else if (hue >= 0 && hue <= 30) {
354
+ saturation = Math.max(saturation - 5, 40);
355
+ }
356
+ return {
357
+ mode: 'hsl',
358
+ desc: {
359
+ h: hue,
360
+ s: saturation,
361
+ l: lightness
362
+ }
363
+ };
364
+ }
365
+
366
+ function presetScalePlugin(options) {
367
+ return domEvent.definePlugin({
368
+ name: 'treemap:preset-scale',
369
+ onDOMEventTriggered (_, event, module, evt) {
370
+ if (domEvent.isWheelEvent(event)) {
371
+ onWheel(this, event, evt);
372
+ }
373
+ },
374
+ meta: {
375
+ scaleOptions: {
376
+ scale: 1,
377
+ minScale: options?.min || 0.1,
378
+ maxScale: options?.max || Infinity,
379
+ scaleFactor: 0.05
380
+ },
381
+ gestureState: {
382
+ isTrackingGesture: false,
383
+ lastEventTime: 0,
384
+ eventCount: 0,
385
+ totalDeltaY: 0,
386
+ totalDeltaX: 0,
387
+ consecutivePinchEvents: 0,
388
+ gestureType: 'unknown',
389
+ lockGestureType: false
390
+ }
391
+ },
392
+ onResize ({ matrix, stateManager: state }) {
393
+ const meta = getScaleOptions.call(this);
394
+ if (meta) {
395
+ meta.scaleOptions.scale = 1;
396
+ }
397
+ matrix.create(domEvent.DEFAULT_MATRIX_LOC);
398
+ state.reset();
399
+ }
400
+ });
401
+ }
402
+ function getScaleOptions() {
403
+ const meta = this.getPluginMetadata('treemap:preset-scale');
404
+ return meta;
405
+ }
406
+ function determineGestureType(event, gestureState) {
407
+ const now = Date.now();
408
+ const timeDiff = now - gestureState.lastEventTime;
409
+ if (timeDiff > 150) {
410
+ Object.assign(gestureState, {
411
+ isTrackingGesture: false,
412
+ lastEventTime: now,
413
+ eventCount: 1,
414
+ totalDeltaY: Math.abs(event.deltaY),
415
+ totalDeltaX: Math.abs(event.deltaX),
416
+ consecutivePinchEvents: 0,
417
+ gestureType: 'unknown',
418
+ lockGestureType: false
419
+ });
420
+ } else {
421
+ gestureState.eventCount++;
422
+ gestureState.totalDeltaY += Math.abs(event.deltaY);
423
+ gestureState.totalDeltaX += Math.abs(event.deltaX);
424
+ gestureState.lastEventTime = now;
425
+ }
426
+ if (event.ctrlKey) {
427
+ gestureState.gestureType = 'zoom';
428
+ gestureState.lockGestureType = true;
429
+ return 'zoom';
430
+ }
431
+ // windows/macos mouse wheel
432
+ // Usually the dettaY is large and deltaX maybe 0 or small number.
433
+ const isMouseWheel = Math.abs(event.deltaX) >= 100 && Math.abs(event.deltaX) <= 10 || Math.abs(event.deltaY) > 50 && Math.abs(event.deltaX) < Math.abs(event.deltaY) * 0.1;
434
+ if (isMouseWheel) {
435
+ gestureState.gestureType = 'zoom';
436
+ gestureState.lockGestureType = true;
437
+ return 'zoom';
438
+ }
439
+ if (gestureState.lockGestureType && gestureState.gestureType !== 'unknown') {
440
+ return gestureState.gestureType;
441
+ }
442
+ // Magic Trackpad or Precision Touchpad
443
+ if (gestureState.eventCount >= 3) {
444
+ const avgDeltaY = gestureState.totalDeltaY / gestureState.eventCount;
445
+ const avgDeltaX = gestureState.totalDeltaX / gestureState.eventCount;
446
+ const ratio = avgDeltaX / (avgDeltaY + 0.1);
447
+ const isZoomGesture = avgDeltaY > 8 && ratio < 0.3 && Math.abs(event.deltaY) > 5;
448
+ if (isZoomGesture) {
449
+ gestureState.gestureType = 'zoom';
450
+ gestureState.lockGestureType = true;
451
+ return 'zoom';
452
+ } else {
453
+ gestureState.gestureType = 'pan';
454
+ gestureState.lockGestureType = true;
455
+ return 'pan';
456
+ }
457
+ }
458
+ return 'pan';
459
+ }
460
+ function onWheel(pluginContext, event, domEvent) {
461
+ event.native.preventDefault();
462
+ const meta = getScaleOptions.call(pluginContext);
463
+ if (!meta) {
464
+ return;
465
+ }
466
+ const gestureType = determineGestureType(event.native, meta.gestureState);
467
+ if (gestureType === 'zoom') {
468
+ handleZoom(pluginContext, event, domEvent);
469
+ } else {
470
+ handlePan(pluginContext, event, domEvent);
471
+ }
472
+ }
473
+ function updateViewport(pluginContext, { stateManager: state, component, matrix }, useAnimation = false) {
474
+ const highlight = getHighlightInstance.apply(pluginContext);
475
+ const doUpdate = ()=>{
476
+ if (highlight && highlight.highlight) {
477
+ highlight.highlight.reset();
478
+ highlight.highlight.setZIndexForHighlight();
479
+ }
480
+ component.cleanup();
481
+ const { width, height } = component.render.options;
482
+ component.layoutNodes = component.calculateLayoutNodes(component.data, {
483
+ w: width * matrix.a,
484
+ h: height * matrix.d,
485
+ x: 0,
486
+ y: 0
487
+ }, 1);
488
+ component.draw(true, false);
489
+ domEvent.stackMatrixTransformWithGraphAndLayer(component.elements, matrix.e, matrix.f, 1);
490
+ component.update();
491
+ if (state.canTransition('IDLE')) {
492
+ state.transition('IDLE');
493
+ }
494
+ };
495
+ if (useAnimation) {
496
+ domEvent.smoothFrame((_, cleanup)=>{
497
+ cleanup();
498
+ doUpdate();
499
+ return true;
500
+ }, {
501
+ duration: ANIMATION_DURATION
502
+ });
503
+ } else {
504
+ doUpdate();
505
+ }
506
+ }
507
+ function handleZoom(pluginContext, event, domEvent) {
508
+ const { stateManager: state, matrix, component } = domEvent;
509
+ const meta = getScaleOptions.call(pluginContext);
510
+ if (!meta) {
511
+ return;
512
+ }
513
+ const { scale, minScale, maxScale, scaleFactor } = meta.scaleOptions;
514
+ const oldMatrix = {
515
+ e: matrix.e,
516
+ f: matrix.f
517
+ };
518
+ const dynamicScaleFactor = Math.max(scaleFactor, scale * 0.1);
519
+ const delta = event.native.deltaY < 0 ? dynamicScaleFactor : -dynamicScaleFactor;
520
+ const newScale = Math.max(minScale, Math.min(maxScale, scale + delta));
521
+ if (newScale === scale) {
522
+ return;
523
+ }
524
+ state.transition('SCALING');
525
+ const mouseX = event.native.offsetX;
526
+ const mouseY = event.native.offsetY;
527
+ const scaleDiff = newScale / scale;
528
+ meta.scaleOptions.scale = newScale;
529
+ matrix.scale(scaleDiff, scaleDiff);
530
+ matrix.e = mouseX - (mouseX - matrix.e) * scaleDiff;
531
+ matrix.f = mouseY - (mouseY - matrix.f) * scaleDiff;
532
+ const newMatrix = {
533
+ e: matrix.e,
534
+ f: matrix.f
535
+ };
536
+ component.handleTransformCacheInvalidation(oldMatrix, newMatrix);
537
+ updateViewport(pluginContext, domEvent, false);
538
+ }
539
+ function handlePan(pluginContext, event, domEvent) {
540
+ const { stateManager: state, matrix } = domEvent;
541
+ const panSpeed = 0.8;
542
+ const deltaX = event.native.deltaX * panSpeed;
543
+ const deltaY = event.native.deltaY * panSpeed;
544
+ state.transition('PANNING');
545
+ matrix.e -= deltaX;
546
+ matrix.f -= deltaY;
547
+ updateViewport(pluginContext, domEvent, true);
548
+ }
549
+
550
+ const MAX_SCALE_MULTIPLIER = 2.0;
551
+ const ZOOM_PADDING_RATIO = 0.85;
552
+ const presetZoomablePlugin = domEvent.definePlugin({
553
+ name: 'treemap:preset-zoomable',
554
+ onLoad (treemap, { stateManager: state, matrix }) {
555
+ return domEvent.mixin(treemap, [
556
+ {
557
+ name: 'zoom',
558
+ fn: ()=>(id)=>{
559
+ const meta = this.getPluginMetadata('treemap:preset-zoomable');
560
+ if (!meta || state.isInState('ZOOMING')) {
561
+ return;
562
+ }
563
+ const targetModule = this.resolveModuleById(id);
564
+ if (!targetModule) {
565
+ return;
566
+ }
567
+ const oldMatrix = {
568
+ e: matrix.e,
569
+ f: matrix.f,
570
+ a: matrix.a
571
+ };
572
+ meta.previousMatrixState = {
573
+ e: matrix.e,
574
+ f: matrix.f,
575
+ a: matrix.a,
576
+ d: matrix.d
577
+ };
578
+ const component = this.instance;
579
+ state.transition('ZOOMING');
580
+ const [nodeX, nodeY, nodeW, nodeH] = targetModule.layout;
581
+ const { width, height } = component.render.options;
582
+ const currentScale = matrix.a;
583
+ // To prevent unlimited scale factor growth.
584
+ const scaleX = width * ZOOM_PADDING_RATIO / nodeW;
585
+ const scaleY = height * ZOOM_PADDING_RATIO / nodeH;
586
+ const idleScale = Math.min(scaleX, scaleY);
587
+ const maxAllowedScale = currentScale * MAX_SCALE_MULTIPLIER;
588
+ const targetScale = Math.max(currentScale, Math.min(idleScale, maxAllowedScale));
589
+ // Real world args
590
+ const viewportCenterX = width / 2;
591
+ const viewportCenterY = height / 2;
592
+ const originalNodeCenterX = (nodeX + nodeW / 2) / currentScale;
593
+ const originalNodeCenterY = (nodeY + nodeH / 2) / currentScale;
594
+ const targetE = viewportCenterX - originalNodeCenterX * targetScale;
595
+ const targetF = viewportCenterY - originalNodeCenterY * targetScale;
596
+ const scaleMeta = getScaleOptions.call(this);
597
+ if (scaleMeta) {
598
+ scaleMeta.scaleOptions.scale = targetScale;
599
+ }
600
+ const highlight = getHighlightInstance.call(this);
601
+ const dragMeta = getDragOptions.call(this);
602
+ if (dragMeta) {
603
+ Object.assign(dragMeta.dragOptions, {
604
+ x: 0,
605
+ y: 0,
606
+ lastX: 0,
607
+ lastY: 0
608
+ });
609
+ }
610
+ const startMatrix = {
611
+ e: matrix.e,
612
+ f: matrix.f,
613
+ a: matrix.a,
614
+ d: matrix.d
615
+ };
616
+ const finalMatrix = {
617
+ e: targetE,
618
+ f: targetF
619
+ };
620
+ component.handleTransformCacheInvalidation(oldMatrix, finalMatrix);
621
+ domEvent.smoothFrame((progress)=>{
622
+ const easedProgress = easing.cubicInOut(progress);
623
+ matrix.create(domEvent.DEFAULT_MATRIX_LOC);
624
+ matrix.e = startMatrix.e + (targetE - startMatrix.e) * easedProgress;
625
+ matrix.f = startMatrix.f + (targetF - startMatrix.f) * easedProgress;
626
+ matrix.a = startMatrix.a + (targetScale - startMatrix.a) * easedProgress;
627
+ matrix.d = startMatrix.d + (targetScale - startMatrix.d) * easedProgress;
628
+ if (highlight?.highlight) {
629
+ highlight.highlight.reset();
630
+ highlight.highlight.setZIndexForHighlight();
631
+ }
632
+ component.cleanup();
633
+ component.layoutNodes = component.calculateLayoutNodes(component.data, {
634
+ w: width * matrix.a,
635
+ h: height * matrix.d,
636
+ x: 0,
637
+ y: 0
638
+ }, 1);
639
+ component.draw(true, false);
640
+ domEvent.stackMatrixTransformWithGraphAndLayer(component.elements, matrix.e, matrix.f, 1);
641
+ component.update();
642
+ }, {
643
+ duration: ANIMATION_DURATION,
644
+ onStop: ()=>{
645
+ state.reset();
646
+ }
647
+ });
648
+ }
649
+ }
650
+ ]);
651
+ },
652
+ meta: {
653
+ isZooming: false
654
+ }
655
+ });
656
+
657
+ exports.presetColorPlugin = presetColorPlugin;
658
+ exports.presetDragElementPlugin = presetDragElementPlugin;
659
+ exports.presetHighlightPlugin = presetHighlightPlugin;
660
+ exports.presetMenuPlugin = presetMenuPlugin;
661
+ exports.presetScalePlugin = presetScalePlugin;
662
+ exports.presetZoomablePlugin = presetZoomablePlugin;