@yanqirenshi/d3.ter 0.0.1 → 0.0.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/components/D3Ter.js +26 -0
- package/dist/index.js +24 -21
- package/dist/js/Atman.js +34 -0
- package/dist/js/Attribute.js +36 -39
- package/dist/js/AttributeInstance.js +14 -2
- package/dist/js/ColumnInstance.js +38 -35
- package/dist/js/Entity.js +6 -376
- package/dist/js/EntityTailor.js +250 -182
- package/dist/js/Identifier.js +35 -39
- package/dist/js/IdentifierInstance.js +18 -30
- package/dist/js/Painter.js +430 -0
- package/dist/js/Port.js +42 -33
- package/dist/js/Rectum.js +191 -0
- package/dist/js/Relationship.js +35 -81
- package/dist/js/utils/Name.js +62 -0
- package/dist/js/utils/Pool.js +48 -0
- package/dist/js/utils/Position.js +22 -0
- package/dist/js/utils/Size.js +21 -0
- package/package.json +1 -1
package/dist/js/EntityTailor.js
CHANGED
|
@@ -7,6 +7,34 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
});
|
|
8
8
|
exports["default"] = void 0;
|
|
9
9
|
|
|
10
|
+
var _Atman2 = _interopRequireDefault(require("./Atman.js"));
|
|
11
|
+
|
|
12
|
+
var _Name = _interopRequireDefault(require("./utils/Name.js"));
|
|
13
|
+
|
|
14
|
+
var _IdentifierInstance = _interopRequireDefault(require("./IdentifierInstance.js"));
|
|
15
|
+
|
|
16
|
+
var _AttributeInstance = _interopRequireDefault(require("./AttributeInstance.js"));
|
|
17
|
+
|
|
18
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
19
|
+
|
|
20
|
+
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
|
|
21
|
+
|
|
22
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
23
|
+
|
|
24
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
25
|
+
|
|
26
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
27
|
+
|
|
28
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
29
|
+
|
|
30
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
31
|
+
|
|
32
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
33
|
+
|
|
34
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
35
|
+
|
|
36
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
37
|
+
|
|
10
38
|
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
11
39
|
|
|
12
40
|
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
@@ -21,35 +49,121 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
|
|
|
21
49
|
|
|
22
50
|
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
23
51
|
|
|
24
|
-
|
|
52
|
+
var Builder = /*#__PURE__*/function (_Atman) {
|
|
53
|
+
_inherits(Builder, _Atman);
|
|
25
54
|
|
|
26
|
-
|
|
55
|
+
var _super = _createSuper(Builder);
|
|
27
56
|
|
|
28
|
-
function
|
|
57
|
+
function Builder(_class, data) {
|
|
58
|
+
var _this;
|
|
29
59
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
33
|
-
|
|
34
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
60
|
+
_classCallCheck(this, Builder);
|
|
35
61
|
|
|
36
|
-
|
|
62
|
+
_this = _super.call(this, _class, data);
|
|
37
63
|
|
|
38
|
-
|
|
64
|
+
_this.init();
|
|
39
65
|
|
|
40
|
-
|
|
66
|
+
_this.name.set(data.name);
|
|
41
67
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
68
|
+
_this.description.contents = data.description;
|
|
69
|
+
_this.position = _objectSpread({}, data.position);
|
|
70
|
+
_this.size = _objectSpread({}, data.size);
|
|
71
|
+
_this.type.contents = _this.entityTypeContents();
|
|
72
|
+
_this.background = _this.entityBackground();
|
|
73
|
+
return _this;
|
|
45
74
|
}
|
|
46
75
|
|
|
47
76
|
_createClass(Builder, [{
|
|
77
|
+
key: "init",
|
|
78
|
+
value: function init() {
|
|
79
|
+
this.padding = 8;
|
|
80
|
+
this.margin = 3;
|
|
81
|
+
this.description = {
|
|
82
|
+
name: ''
|
|
83
|
+
};
|
|
84
|
+
this.description = {
|
|
85
|
+
contents: ''
|
|
86
|
+
};
|
|
87
|
+
this.position = {
|
|
88
|
+
x: 0,
|
|
89
|
+
y: 0,
|
|
90
|
+
z: 0
|
|
91
|
+
};
|
|
92
|
+
this.size = {
|
|
93
|
+
w: 0,
|
|
94
|
+
h: 0
|
|
95
|
+
};
|
|
96
|
+
this.bar = {
|
|
97
|
+
size: {
|
|
98
|
+
horizontal: 3,
|
|
99
|
+
header: 3,
|
|
100
|
+
contents: 3
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
this.background = {
|
|
104
|
+
color: ''
|
|
105
|
+
};
|
|
106
|
+
this.name = new _Name["default"]();
|
|
107
|
+
this.type = {
|
|
108
|
+
contents: '??',
|
|
109
|
+
padding: 8,
|
|
110
|
+
position: {
|
|
111
|
+
x: 0,
|
|
112
|
+
y: 0,
|
|
113
|
+
z: 0
|
|
114
|
+
},
|
|
115
|
+
size: {
|
|
116
|
+
w: 0,
|
|
117
|
+
h: 0
|
|
118
|
+
}
|
|
119
|
+
};
|
|
120
|
+
this.identifiers = {
|
|
121
|
+
padding: 0,
|
|
122
|
+
position: {
|
|
123
|
+
x: 0,
|
|
124
|
+
y: 0,
|
|
125
|
+
z: 0
|
|
126
|
+
},
|
|
127
|
+
size: {
|
|
128
|
+
w: null,
|
|
129
|
+
h: null
|
|
130
|
+
},
|
|
131
|
+
items: {
|
|
132
|
+
list: [],
|
|
133
|
+
ht: {}
|
|
134
|
+
}
|
|
135
|
+
};
|
|
136
|
+
this.attributes = {
|
|
137
|
+
padding: 0,
|
|
138
|
+
position: {
|
|
139
|
+
x: 0,
|
|
140
|
+
y: 0,
|
|
141
|
+
z: 0
|
|
142
|
+
},
|
|
143
|
+
size: {
|
|
144
|
+
w: null,
|
|
145
|
+
h: null
|
|
146
|
+
},
|
|
147
|
+
items: {
|
|
148
|
+
list: [],
|
|
149
|
+
ht: {}
|
|
150
|
+
}
|
|
151
|
+
};
|
|
152
|
+
this.ports = {
|
|
153
|
+
items: {
|
|
154
|
+
list: [],
|
|
155
|
+
ht: {}
|
|
156
|
+
}
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
}, {
|
|
48
160
|
key: "template",
|
|
49
161
|
value: function template() {
|
|
50
162
|
return {
|
|
51
163
|
_id: null,
|
|
52
164
|
_class: 'ENTITY',
|
|
165
|
+
padding: 11,
|
|
166
|
+
margin: 6,
|
|
53
167
|
description: {
|
|
54
168
|
contents: ''
|
|
55
169
|
},
|
|
@@ -62,8 +176,6 @@ var Builder = /*#__PURE__*/function () {
|
|
|
62
176
|
w: 0,
|
|
63
177
|
h: 0
|
|
64
178
|
},
|
|
65
|
-
padding: 11,
|
|
66
|
-
margin: 6,
|
|
67
179
|
bar: {
|
|
68
180
|
size: {
|
|
69
181
|
header: 11,
|
|
@@ -74,6 +186,8 @@ var Builder = /*#__PURE__*/function () {
|
|
|
74
186
|
color: ''
|
|
75
187
|
},
|
|
76
188
|
name: {
|
|
189
|
+
padding: 11,
|
|
190
|
+
contents: '',
|
|
77
191
|
position: {
|
|
78
192
|
x: 0,
|
|
79
193
|
y: 0,
|
|
@@ -82,12 +196,11 @@ var Builder = /*#__PURE__*/function () {
|
|
|
82
196
|
size: {
|
|
83
197
|
h: null,
|
|
84
198
|
w: null
|
|
85
|
-
}
|
|
86
|
-
padding: 11,
|
|
87
|
-
contents: ''
|
|
199
|
+
}
|
|
88
200
|
},
|
|
89
201
|
type: {
|
|
90
202
|
contents: '??',
|
|
203
|
+
padding: 11,
|
|
91
204
|
position: {
|
|
92
205
|
x: 0,
|
|
93
206
|
y: 0,
|
|
@@ -96,10 +209,10 @@ var Builder = /*#__PURE__*/function () {
|
|
|
96
209
|
size: {
|
|
97
210
|
w: 0,
|
|
98
211
|
h: 0
|
|
99
|
-
}
|
|
100
|
-
padding: 11
|
|
212
|
+
}
|
|
101
213
|
},
|
|
102
214
|
identifiers: {
|
|
215
|
+
padding: 8,
|
|
103
216
|
position: {
|
|
104
217
|
x: 0,
|
|
105
218
|
y: 0,
|
|
@@ -109,13 +222,13 @@ var Builder = /*#__PURE__*/function () {
|
|
|
109
222
|
w: null,
|
|
110
223
|
h: null
|
|
111
224
|
},
|
|
112
|
-
padding: 8,
|
|
113
225
|
items: {
|
|
114
226
|
list: [],
|
|
115
227
|
ht: {}
|
|
116
228
|
}
|
|
117
229
|
},
|
|
118
230
|
attributes: {
|
|
231
|
+
padding: 8,
|
|
119
232
|
position: {
|
|
120
233
|
x: 0,
|
|
121
234
|
y: 0,
|
|
@@ -125,7 +238,6 @@ var Builder = /*#__PURE__*/function () {
|
|
|
125
238
|
w: null,
|
|
126
239
|
h: null
|
|
127
240
|
},
|
|
128
|
-
padding: 8,
|
|
129
241
|
items: {
|
|
130
242
|
list: [],
|
|
131
243
|
ht: {}
|
|
@@ -141,8 +253,10 @@ var Builder = /*#__PURE__*/function () {
|
|
|
141
253
|
}
|
|
142
254
|
}, {
|
|
143
255
|
key: "entityTypeContents",
|
|
144
|
-
value: function entityTypeContents(
|
|
145
|
-
|
|
256
|
+
value: function entityTypeContents() {
|
|
257
|
+
var type = this._core.type;
|
|
258
|
+
|
|
259
|
+
switch (type) {
|
|
146
260
|
case 'RESOURCE':
|
|
147
261
|
return 'Rsc';
|
|
148
262
|
|
|
@@ -159,12 +273,12 @@ var Builder = /*#__PURE__*/function () {
|
|
|
159
273
|
return 'Evt';
|
|
160
274
|
|
|
161
275
|
default:
|
|
162
|
-
throw new Error(
|
|
276
|
+
throw new Error(type + " は知らないよ。");
|
|
163
277
|
}
|
|
164
278
|
}
|
|
165
279
|
}, {
|
|
166
280
|
key: "entityBackground",
|
|
167
|
-
value: function entityBackground(
|
|
281
|
+
value: function entityBackground() {
|
|
168
282
|
var background = {
|
|
169
283
|
"resource": {
|
|
170
284
|
color: '#89c3eb'
|
|
@@ -188,26 +302,30 @@ var Builder = /*#__PURE__*/function () {
|
|
|
188
302
|
color: '#dbd0e6'
|
|
189
303
|
}
|
|
190
304
|
};
|
|
191
|
-
|
|
305
|
+
|
|
306
|
+
var key = this._core.type.toLowerCase();
|
|
307
|
+
|
|
308
|
+
return background[key];
|
|
192
309
|
}
|
|
193
310
|
}, {
|
|
194
311
|
key: "buildIdentifiers",
|
|
195
|
-
value: function buildIdentifiers(
|
|
312
|
+
value: function buildIdentifiers(state) {
|
|
196
313
|
var out = {
|
|
197
314
|
list: [],
|
|
198
315
|
ht: {}
|
|
199
316
|
};
|
|
200
317
|
var masters = state.identifiers.ht;
|
|
318
|
+
var targets = this._core.identifiers;
|
|
201
319
|
|
|
202
|
-
var _iterator = _createForOfIteratorHelper(
|
|
320
|
+
var _iterator = _createForOfIteratorHelper(targets),
|
|
203
321
|
_step;
|
|
204
322
|
|
|
205
323
|
try {
|
|
206
324
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
207
|
-
var
|
|
208
|
-
var master = masters[
|
|
209
|
-
var element =
|
|
210
|
-
element._entity =
|
|
325
|
+
var data = _step.value;
|
|
326
|
+
var master = masters[data.identifier];
|
|
327
|
+
var element = new _IdentifierInstance["default"](master, data);
|
|
328
|
+
element._entity = this;
|
|
211
329
|
out.list.push(element);
|
|
212
330
|
out.ht[element._id] = element;
|
|
213
331
|
}
|
|
@@ -235,22 +353,23 @@ var Builder = /*#__PURE__*/function () {
|
|
|
235
353
|
}
|
|
236
354
|
}, {
|
|
237
355
|
key: "buildAttributes",
|
|
238
|
-
value: function buildAttributes(
|
|
356
|
+
value: function buildAttributes(state) {
|
|
239
357
|
var out = {
|
|
240
358
|
list: [],
|
|
241
359
|
ht: {}
|
|
242
360
|
};
|
|
243
361
|
var masters = state.attributes.ht;
|
|
362
|
+
var targets = this._core.attributes;
|
|
244
363
|
|
|
245
|
-
var _iterator2 = _createForOfIteratorHelper(
|
|
364
|
+
var _iterator2 = _createForOfIteratorHelper(targets),
|
|
246
365
|
_step2;
|
|
247
366
|
|
|
248
367
|
try {
|
|
249
368
|
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
250
369
|
var attribute = _step2.value;
|
|
251
370
|
var master = masters[attribute.attribute];
|
|
252
|
-
var element =
|
|
253
|
-
element._entity =
|
|
371
|
+
var element = new _AttributeInstance["default"](master, attribute);
|
|
372
|
+
element._entity = this;
|
|
254
373
|
out.list.push(element);
|
|
255
374
|
out.ht[element._id] = element;
|
|
256
375
|
}
|
|
@@ -278,35 +397,25 @@ var Builder = /*#__PURE__*/function () {
|
|
|
278
397
|
}
|
|
279
398
|
}, {
|
|
280
399
|
key: "build",
|
|
281
|
-
value: function build(
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
element.description.contents = core.description;
|
|
286
|
-
element.position = _objectSpread({}, core.position);
|
|
287
|
-
element.size = _objectSpread({}, core.size);
|
|
288
|
-
element.type.contents = this.entityTypeContents(core);
|
|
289
|
-
element.identifiers = this.buildIdentifiers(core, state, element);
|
|
290
|
-
element.attributes = this.buildAttributes(core, state, element);
|
|
291
|
-
element.background = this.entityBackground(core);
|
|
292
|
-
element._core = core;
|
|
293
|
-
core._element = element;
|
|
294
|
-
return element;
|
|
400
|
+
value: function build(state) {
|
|
401
|
+
this.identifiers = this.buildIdentifiers(state);
|
|
402
|
+
this.attributes = this.buildAttributes(state);
|
|
403
|
+
return this;
|
|
295
404
|
}
|
|
296
405
|
}]);
|
|
297
406
|
|
|
298
407
|
return Builder;
|
|
299
|
-
}();
|
|
408
|
+
}(_Atman2["default"]);
|
|
300
409
|
|
|
301
410
|
var EntityTailor = /*#__PURE__*/function (_Builder) {
|
|
302
411
|
_inherits(EntityTailor, _Builder);
|
|
303
412
|
|
|
304
|
-
var
|
|
413
|
+
var _super2 = _createSuper(EntityTailor);
|
|
305
414
|
|
|
306
415
|
function EntityTailor() {
|
|
307
416
|
_classCallCheck(this, EntityTailor);
|
|
308
417
|
|
|
309
|
-
return
|
|
418
|
+
return _super2.apply(this, arguments);
|
|
310
419
|
}
|
|
311
420
|
|
|
312
421
|
_createClass(EntityTailor, [{
|
|
@@ -315,111 +424,80 @@ var EntityTailor = /*#__PURE__*/function (_Builder) {
|
|
|
315
424
|
/* **************************************************************** *
|
|
316
425
|
* Size
|
|
317
426
|
* **************************************************************** */
|
|
318
|
-
function sizingType(
|
|
319
|
-
var data =
|
|
427
|
+
function sizingType() {
|
|
428
|
+
var data = this.type;
|
|
320
429
|
if (!data.contents) data.contents = '??';
|
|
321
430
|
data.size.h = this._default.line.height + data.padding * 2;
|
|
322
|
-
data.size.w = data.contents.length * this._default.line.font.size + data.padding * 2;
|
|
431
|
+
data.size.w = data.contents.length * this._default.line.font.size; // + data.padding * 2;
|
|
323
432
|
}
|
|
324
433
|
}, {
|
|
325
434
|
key: "sizingName",
|
|
326
|
-
value: function sizingName(
|
|
327
|
-
var data =
|
|
435
|
+
value: function sizingName() {
|
|
436
|
+
var data = this.name;
|
|
328
437
|
if (!data.contents) data.contents = '????????';
|
|
329
438
|
data.size.h = this._default.line.height + data.padding * 2;
|
|
330
|
-
var type =
|
|
331
|
-
data.size.w =
|
|
439
|
+
var type = this.type;
|
|
440
|
+
data.size.w = this.size.w - this.padding * 2 - this.bar.size.header - type.size.w;
|
|
332
441
|
}
|
|
333
442
|
}, {
|
|
334
443
|
key: "sizingIdentifiers",
|
|
335
|
-
value: function sizingIdentifiers(
|
|
336
|
-
var data =
|
|
337
|
-
var padding =
|
|
338
|
-
data.size.w = (
|
|
444
|
+
value: function sizingIdentifiers() {
|
|
445
|
+
var data = this.identifiers;
|
|
446
|
+
var padding = this.padding;
|
|
447
|
+
data.size.w = (this.size.w - padding * 2) / 2 - this.bar.size.contents / 2;
|
|
339
448
|
data.size.h = data.contents.list.length * (this._default.line.height + padding * 2);
|
|
340
449
|
}
|
|
341
450
|
}, {
|
|
342
451
|
key: "sizingAttributes",
|
|
343
|
-
value: function sizingAttributes(
|
|
344
|
-
var data =
|
|
345
|
-
var padding =
|
|
346
|
-
data.size.w = (
|
|
452
|
+
value: function sizingAttributes() {
|
|
453
|
+
var data = this.attributes;
|
|
454
|
+
var padding = this.padding;
|
|
455
|
+
data.size.w = (this.size.w - this.padding * 2) / 2 - this.bar.size.contents / 2;
|
|
347
456
|
data.size.h = data.contents.list.length * (this._default.line.height + padding * 2);
|
|
348
457
|
}
|
|
349
458
|
}, {
|
|
350
459
|
key: "sizingContentsArea",
|
|
351
|
-
value: function sizingContentsArea(
|
|
352
|
-
var id_h =
|
|
353
|
-
var attr_h =
|
|
354
|
-
if (id_h > attr_h)
|
|
355
|
-
}
|
|
356
|
-
}, {
|
|
357
|
-
key: "sizingEntity",
|
|
358
|
-
value: function sizingEntity(entity) {
|
|
359
|
-
this.sizingType(entity);
|
|
360
|
-
this.sizingName(entity);
|
|
361
|
-
this.sizingIdentifiers(entity);
|
|
362
|
-
this.sizingAttributes(entity);
|
|
363
|
-
this.sizingContentsArea(entity);
|
|
364
|
-
var padding = entity.padding * 2;
|
|
365
|
-
var header = entity.name.size.h;
|
|
366
|
-
var margin = 11;
|
|
367
|
-
var contents = entity.attributes.size.h;
|
|
368
|
-
entity.size.h = padding + header + margin + contents;
|
|
369
|
-
}
|
|
370
|
-
}, {
|
|
371
|
-
key: "sizingEntities",
|
|
372
|
-
value: function sizingEntities(entities) {
|
|
373
|
-
var _iterator3 = _createForOfIteratorHelper(entities),
|
|
374
|
-
_step3;
|
|
375
|
-
|
|
376
|
-
try {
|
|
377
|
-
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
378
|
-
var entity = _step3.value;
|
|
379
|
-
this.sizingEntity(entity);
|
|
380
|
-
}
|
|
381
|
-
} catch (err) {
|
|
382
|
-
_iterator3.e(err);
|
|
383
|
-
} finally {
|
|
384
|
-
_iterator3.f();
|
|
385
|
-
}
|
|
460
|
+
value: function sizingContentsArea() {
|
|
461
|
+
var id_h = this.identifiers.size.h;
|
|
462
|
+
var attr_h = this.attributes.size.h;
|
|
463
|
+
if (id_h > attr_h) this.attributes.size.h = id_h;else this.identifiers.size.h = attr_h;
|
|
386
464
|
}
|
|
387
465
|
}, {
|
|
388
466
|
key: "sizing",
|
|
389
|
-
value: function sizing(
|
|
390
|
-
this.
|
|
467
|
+
value: function sizing() {
|
|
468
|
+
this.sizingType();
|
|
469
|
+
this.sizingName();
|
|
470
|
+
this.sizingIdentifiers();
|
|
471
|
+
this.sizingAttributes();
|
|
472
|
+
this.sizingContentsArea();
|
|
473
|
+
var padding = this.padding * 2;
|
|
474
|
+
var header = this.name.size.h;
|
|
475
|
+
var bar = this.bar.size.horizontal;
|
|
476
|
+
var contents = this.attributes.size.h;
|
|
477
|
+
this.size.h = padding + header + bar + contents;
|
|
391
478
|
return this;
|
|
392
479
|
}
|
|
393
480
|
}, {
|
|
394
|
-
key: "
|
|
395
|
-
value: function
|
|
481
|
+
key: "reSizing",
|
|
482
|
+
value: function reSizing() {
|
|
483
|
+
var entity = this;
|
|
396
484
|
entity.name.size.w = Math.ceil(entity._max_w.name) + entity.name.padding * 2;
|
|
397
485
|
entity.identifiers.size.w = Math.ceil(entity._max_w.identifier) + entity.identifiers.padding * 2;
|
|
398
486
|
entity.attributes.size.w = Math.ceil(entity._max_w.attribute) + entity.attributes.padding * 2;
|
|
399
|
-
var name_area_w = entity.name.size.w + entity.bar.size.header + entity.type.size.w
|
|
400
|
-
var contents_area_w = entity.identifiers.size.w + entity.bar.size.contents + entity.attributes.size.w
|
|
401
|
-
entity.size.w = contents_area_w > name_area_w ? contents_area_w : name_area_w; // fix size for attr area
|
|
487
|
+
var name_area_w = entity.name.size.w + entity.bar.size.header + entity.type.size.w;
|
|
488
|
+
var contents_area_w = entity.identifiers.size.w + entity.bar.size.contents + entity.attributes.size.w;
|
|
489
|
+
entity.size.w = (contents_area_w > name_area_w ? contents_area_w : name_area_w) + entity.padding * 2; // fix size for attr area
|
|
402
490
|
|
|
403
491
|
if (entity._max_w.attribute === 0 || contents_area_w < name_area_w) {
|
|
404
|
-
entity.attributes.size.w = entity.size.w - entity.identifiers.size.w - entity.bar.size.contents
|
|
492
|
+
entity.attributes.size.w = entity.size.w - entity.padding * 2 - entity.identifiers.size.w - entity.bar.size.contents;
|
|
405
493
|
} // fix size for name area
|
|
406
494
|
|
|
407
495
|
|
|
408
496
|
if (contents_area_w > name_area_w) {
|
|
409
|
-
entity.name.size.w = entity.size.w - entity.bar.size.header - entity.type.size.w
|
|
497
|
+
entity.name.size.w = entity.size.w - entity.padding * 2 - entity.bar.size.header - entity.type.size.w;
|
|
410
498
|
}
|
|
411
|
-
}
|
|
412
|
-
}, {
|
|
413
|
-
key: "reSizing",
|
|
414
|
-
value: function reSizing(groups, entities) {
|
|
415
|
-
var _this = this;
|
|
416
499
|
|
|
417
|
-
|
|
418
|
-
_this.reSizingEntity(entity);
|
|
419
|
-
|
|
420
|
-
_this.positioningEntity(entity, entities);
|
|
421
|
-
});
|
|
422
|
-
this.redraw(groups);
|
|
500
|
+
return this;
|
|
423
501
|
}
|
|
424
502
|
/* **************************************************************** *
|
|
425
503
|
* Position
|
|
@@ -427,52 +505,65 @@ var EntityTailor = /*#__PURE__*/function (_Builder) {
|
|
|
427
505
|
|
|
428
506
|
}, {
|
|
429
507
|
key: "positioningName",
|
|
430
|
-
value: function positioningName(
|
|
508
|
+
value: function positioningName() {
|
|
509
|
+
var entity = this;
|
|
431
510
|
var d = entity.name;
|
|
432
511
|
d.position.x = entity.padding;
|
|
433
512
|
d.position.y = entity.padding;
|
|
434
513
|
}
|
|
435
514
|
}, {
|
|
436
515
|
key: "positioningType",
|
|
437
|
-
value: function positioningType(
|
|
516
|
+
value: function positioningType() {
|
|
517
|
+
var entity = this;
|
|
438
518
|
var d = entity.type;
|
|
439
|
-
var
|
|
440
|
-
d.position.x = entity.padding + entity.name.size.w +
|
|
519
|
+
var bar = this.bar.size.header;
|
|
520
|
+
d.position.x = entity.padding + entity.name.size.w + bar;
|
|
441
521
|
d.position.y = entity.padding;
|
|
442
522
|
}
|
|
443
523
|
}, {
|
|
444
524
|
key: "positioningColumnItems",
|
|
445
525
|
value: function positioningColumnItems(d) {
|
|
446
|
-
var len = d.contents.list.length;
|
|
447
526
|
var padding = d.padding;
|
|
448
527
|
var start = d.position.y;
|
|
449
528
|
var line_height = this._default.line.height;
|
|
450
|
-
var
|
|
451
|
-
|
|
529
|
+
var y = 0;
|
|
530
|
+
|
|
531
|
+
var _iterator3 = _createForOfIteratorHelper(d.contents.list),
|
|
532
|
+
_step3;
|
|
452
533
|
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
534
|
+
try {
|
|
535
|
+
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
536
|
+
var item = _step3.value;
|
|
537
|
+
item.position.x = d.position.x + padding;
|
|
538
|
+
var item_h = line_height + item.name.padding * 2;
|
|
539
|
+
item.position.y = start + padding + line_height + y * item_h;
|
|
540
|
+
y = item.position.y;
|
|
541
|
+
}
|
|
542
|
+
} catch (err) {
|
|
543
|
+
_iterator3.e(err);
|
|
544
|
+
} finally {
|
|
545
|
+
_iterator3.f();
|
|
457
546
|
}
|
|
458
547
|
}
|
|
459
548
|
}, {
|
|
460
549
|
key: "positioningIdentifiers",
|
|
461
|
-
value: function positioningIdentifiers(
|
|
550
|
+
value: function positioningIdentifiers() {
|
|
551
|
+
var entity = this;
|
|
462
552
|
var d = entity.identifiers;
|
|
463
|
-
var
|
|
553
|
+
var bar = this.bar.size.horizontal;
|
|
464
554
|
d.position.x = entity.padding;
|
|
465
|
-
d.position.y = entity.padding + entity.name.size.h +
|
|
555
|
+
d.position.y = entity.padding + entity.name.size.h + bar;
|
|
466
556
|
this.positioningColumnItems(d);
|
|
467
557
|
}
|
|
468
558
|
}, {
|
|
469
559
|
key: "positioningAttributes",
|
|
470
|
-
value: function positioningAttributes(
|
|
560
|
+
value: function positioningAttributes() {
|
|
561
|
+
var entity = this;
|
|
471
562
|
var d = entity.attributes;
|
|
472
|
-
var
|
|
473
|
-
var
|
|
474
|
-
d.position.x = entity.padding +
|
|
475
|
-
d.position.y = entity.padding + entity.name.size.h +
|
|
563
|
+
var bar_contents = this.bar.size.contents;
|
|
564
|
+
var bar_horizontal = this.bar.size.horizontal;
|
|
565
|
+
d.position.x = entity.padding + bar_contents + entity.identifiers.size.w;
|
|
566
|
+
d.position.y = entity.padding + entity.name.size.h + bar_horizontal;
|
|
476
567
|
this.positioningColumnItems(d);
|
|
477
568
|
}
|
|
478
569
|
}, {
|
|
@@ -512,7 +603,7 @@ var EntityTailor = /*#__PURE__*/function (_Builder) {
|
|
|
512
603
|
out.from.y = from.y;
|
|
513
604
|
var x = 0;
|
|
514
605
|
var y = this.getPortLineLength(entity);
|
|
515
|
-
var degree = port.
|
|
606
|
+
var degree = port.position_degree();
|
|
516
607
|
var radian = this.deg2rad(degree);
|
|
517
608
|
var cos = Math.cos(radian);
|
|
518
609
|
var sin = Math.sin(radian);
|
|
@@ -619,7 +710,8 @@ var EntityTailor = /*#__PURE__*/function (_Builder) {
|
|
|
619
710
|
}
|
|
620
711
|
}, {
|
|
621
712
|
key: "positioningPort",
|
|
622
|
-
value: function positioningPort(
|
|
713
|
+
value: function positioningPort(port) {
|
|
714
|
+
var entity = this;
|
|
623
715
|
var line_port = this.makePortLine(entity, port);
|
|
624
716
|
var lines_entity = this.getEntityLines(entity);
|
|
625
717
|
var point = this.getCrossPoint(lines_entity, line_port, port);
|
|
@@ -632,27 +724,16 @@ var EntityTailor = /*#__PURE__*/function (_Builder) {
|
|
|
632
724
|
}
|
|
633
725
|
}, {
|
|
634
726
|
key: "positioningPorts",
|
|
635
|
-
value: function positioningPorts(
|
|
636
|
-
var
|
|
727
|
+
value: function positioningPorts() {
|
|
728
|
+
var ports = this.ports.items.list;
|
|
729
|
+
|
|
730
|
+
var _iterator5 = _createForOfIteratorHelper(ports),
|
|
637
731
|
_step5;
|
|
638
732
|
|
|
639
733
|
try {
|
|
640
734
|
for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
|
|
641
|
-
var
|
|
642
|
-
|
|
643
|
-
var _iterator6 = _createForOfIteratorHelper(_entity.ports.items.list),
|
|
644
|
-
_step6;
|
|
645
|
-
|
|
646
|
-
try {
|
|
647
|
-
for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
|
|
648
|
-
var port = _step6.value;
|
|
649
|
-
this.positioningPort(_entity, port);
|
|
650
|
-
}
|
|
651
|
-
} catch (err) {
|
|
652
|
-
_iterator6.e(err);
|
|
653
|
-
} finally {
|
|
654
|
-
_iterator6.f();
|
|
655
|
-
}
|
|
735
|
+
var port = _step5.value;
|
|
736
|
+
this.positioningPort(port);
|
|
656
737
|
}
|
|
657
738
|
} catch (err) {
|
|
658
739
|
_iterator5.e(err);
|
|
@@ -663,29 +744,16 @@ var EntityTailor = /*#__PURE__*/function (_Builder) {
|
|
|
663
744
|
}, {
|
|
664
745
|
key: "positioningEntity",
|
|
665
746
|
value: function positioningEntity(entity, entities) {
|
|
666
|
-
this.positioningName(
|
|
667
|
-
this.positioningType(
|
|
668
|
-
this.positioningIdentifiers(
|
|
669
|
-
this.positioningAttributes(
|
|
670
|
-
this.positioningPorts(
|
|
747
|
+
this.positioningName();
|
|
748
|
+
this.positioningType();
|
|
749
|
+
this.positioningIdentifiers();
|
|
750
|
+
this.positioningAttributes();
|
|
751
|
+
this.positioningPorts();
|
|
671
752
|
}
|
|
672
753
|
}, {
|
|
673
754
|
key: "positioning",
|
|
674
755
|
value: function positioning() {
|
|
675
|
-
|
|
676
|
-
_step7;
|
|
677
|
-
|
|
678
|
-
try {
|
|
679
|
-
for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
|
|
680
|
-
var entity = _step7.value;
|
|
681
|
-
this.positioningEntity(entity);
|
|
682
|
-
}
|
|
683
|
-
} catch (err) {
|
|
684
|
-
_iterator7.e(err);
|
|
685
|
-
} finally {
|
|
686
|
-
_iterator7.f();
|
|
687
|
-
}
|
|
688
|
-
|
|
756
|
+
this.positioningEntity(this);
|
|
689
757
|
return this;
|
|
690
758
|
}
|
|
691
759
|
}]);
|