1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111 | 1×
1×
1×
1×
1308×
1308×
1×
40×
40×
40×
40×
40×
40×
132×
132×
40×
14×
14×
14×
14×
14×
11×
11×
11×
66×
66×
66×
66×
1×
18×
18×
18×
190×
190×
190×
18×
18×
18×
18×
18×
18×
18×
18×
18×
1×
1×
132×
110×
1115×
1115×
1115×
132×
22×
22×
22×
22×
22×
22×
22×
22×
22×
22×
22×
22×
1×
1×
288×
222×
222×
222×
222×
666×
666×
666×
666×
222×
1×
1×
46813×
1×
1×
| define(["require", "exports", "../core/containers/container", "../enum/enum", "../utility/base-util", "../utility/diagram-util"], function (require, exports, container_1, enum_1, base_util_1, diagram_util_1) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var LayoutAnimation = (function () {
function LayoutAnimation() {
this.protectChange = false;
this.setIntervalObject = [];
}
LayoutAnimation.prototype.expand = function (animation, objects, node, diagram) {
var _this = this;
var setIntervalObject = {};
var i = 0;
var j = 0;
diagram.realActions = diagram.realActions | enum_1.RealAction.AnimationClick;
this.setIntervalObject[parseInt(i.toString(), 10)] = setInterval(function () {
j++;
return _this.layoutAnimation(objects, _this.setIntervalObject, j === 6, diagram, node);
}, 20);
if (node.isExpanded) {
var opacity_1 = .2;
diagram.protectPropertyChange(false);
var setIntervalObjects_1 = {};
var x = 0;
if (animation) {
this.updateOpacity(node, opacity_1, diagram);
var current = this;
setIntervalObjects_1[parseInt(x.toString(), 10)] = setInterval(function () {
diagram.allowServerDataBinding = false;
opacity_1 <= 1 ? _this.updateOpacity(node, opacity_1, diagram) : clearInterval(setIntervalObjects_1[0]);
opacity_1 += .2;
diagram.allowServerDataBinding = true;
}, 20);
}
}
};
LayoutAnimation.prototype.stopCurrentAnimation = function (objValue, diagram, node) {
clearInterval(this.setIntervalObject[0]);
this.setIntervalObject = [];
for (var k = 0; k < objValue.objects.length; k++) {
var node1 = diagram.nameTable[objValue.objects[parseInt(k.toString(), 10)].id];
node1.offsetX += objValue.objects[parseInt(k.toString(), 10)].differenceX
- (objValue.objects[parseInt(k.toString(), 10)].differenceX / 5);
node1.offsetY += objValue.objects[parseInt(k.toString(), 10)].differenceY
- (objValue.objects[parseInt(k.toString(), 10)].differenceY / 5);
}
diagram.realActions = diagram.realActions & enum_1.RealAction.AnimationClick;
diagram.refreshCanvasLayers();
diagram.protectPropertyChange(true);
diagram.triggerEvent(enum_1.DiagramEvent.animationComplete, undefined);
diagram.layout.fixedNode = '';
diagram.protectPropertyChange(this.protectChange);
var arg = {
element: diagram_util_1.cloneBlazorObject(base_util_1.cloneObject(node)), state: (node.isExpanded) ? true : false
};
diagram.triggerEvent(enum_1.DiagramEvent.expandStateChange, arg);
if (diagram.lineRoutingModule && diagram.constraints & enum_1.DiagramConstraints.LineRouting) {
diagram.resetSegments();
}
};
LayoutAnimation.prototype.layoutAnimation = function (objValue, layoutTimer, stop, diagram, node) {
if (!stop) {
for (var k = 0; k < objValue.objects.length; k++) {
var node_1 = diagram.nameTable[objValue.objects[parseInt(k.toString(), 10)].id];
node_1.offsetX += objValue.objects[parseInt(k.toString(), 10)].differenceX / 5;
node_1.offsetY += objValue.objects[parseInt(k.toString(), 10)].differenceY / 5;
}
}
if (stop) {
clearInterval(layoutTimer[0]);
this.setIntervalObject = [];
diagram.realActions = diagram.realActions & ~enum_1.RealAction.AnimationClick;
diagram.refreshCanvasLayers();
diagram.protectPropertyChange(true);
diagram.triggerEvent(enum_1.DiagramEvent.animationComplete, undefined);
diagram.organizationalChartModule.isAnimation = false;
diagram.layout.fixedNode = '';
diagram.protectPropertyChange(this.protectChange);
var arg = {
element: diagram_util_1.cloneBlazorObject(base_util_1.cloneObject(node)), state: (node.isExpanded) ? true : false
};
diagram.triggerEvent(enum_1.DiagramEvent.expandStateChange, arg);
if (diagram.lineRoutingModule && diagram.constraints & enum_1.DiagramConstraints.LineRouting) {
diagram.resetSegments();
}
}
};
LayoutAnimation.prototype.updateOpacity = function (source, value, diagram) {
for (var i = 0; i < source.outEdges.length; i++) {
var connector = diagram.nameTable[source.outEdges[parseInt(i.toString(), 10)]];
var target = diagram.nameTable[connector.targetID];
connector.style.opacity = value;
for (var j = 0; j < connector.wrapper.children.length; j++) {
connector.wrapper.children[parseInt(j.toString(), 10)].style.opacity = value;
target.style.opacity = value;
Eif (target.wrapper instanceof container_1.Container) {
diagram.updateNodeProperty(target.wrapper, undefined, value);
}
}
this.updateOpacity(target, value, diagram);
}
};
LayoutAnimation.prototype.destroy = function () {
};
LayoutAnimation.prototype.getModuleName = function () {
return 'LayoutAnimate';
};
return LayoutAnimation;
}());
exports.LayoutAnimation = LayoutAnimation;
});
|