@yanqirenshi/d3.wireframe 0.1.1 → 0.2.1
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/LICENSE +21 -0
- package/README.markdown +68 -68
- package/dist/Digestion.js +20 -20
- package/dist/Drawer.js +20 -20
- package/dist/Element.js +8 -8
- package/dist/ElementButton.js +11 -25
- package/dist/ElementDialog.js +10 -24
- package/dist/ElementFounder.js +48 -4
- package/dist/ElementFrame.js +10 -24
- package/dist/ElementIcon.js +19 -7
- package/dist/ElementImage.js +10 -24
- package/dist/ElementLabel.js +17 -8
- package/dist/ElementModal.js +13 -15
- package/dist/Projector.js +115 -0
- package/dist/Rectum.js +149 -16
- package/dist/components/D3Wireframe.js +5 -1
- package/dist/index.js +7 -0
- package/package.json +7 -6
- package/src/DataBackground.js +23 -23
- package/src/DataFont.js +25 -25
- package/src/DataPosition.js +21 -21
- package/src/DataRectangle.js +20 -20
- package/src/DataStroke.js +23 -23
- package/src/Digestion.js +273 -273
- package/src/Drawer.js +270 -270
- package/src/Element.js +67 -67
- package/src/ElementButton.js +84 -94
- package/src/ElementDialog.js +67 -77
- package/src/ElementFounder.js +124 -85
- package/src/ElementFrame.js +67 -77
- package/src/ElementIcon.js +72 -56
- package/src/ElementImage.js +67 -77
- package/src/ElementLabel.js +66 -51
- package/src/ElementModal.js +61 -65
- package/src/Projector.js +100 -0
- package/src/Rectum.js +122 -3
- package/src/components/D3Wireframe.js +5 -1
- package/src/index.js +2 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2018-2026 Satoshi Iwasaki (yanqirenshi@gmail.com)
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.markdown
CHANGED
|
@@ -1,68 +1,68 @@
|
|
|
1
|
-
# D3.Wireframe
|
|
2
|
-
|
|
3
|
-
ワイヤーフレームをスケッチするためのライブラリです。
|
|
4
|
-
|
|
5
|
-
# Expression
|
|
6
|
-
|
|
7
|
-
以下の要素を描画できます。
|
|
8
|
-
|
|
9
|
-
| Element | element_type | type |
|
|
10
|
-
|-----------------|----------------|------|
|
|
11
|
-
| label | label | 1 |
|
|
12
|
-
| button | button | 2 |
|
|
13
|
-
| Frame(Plain) | frame | 2 |
|
|
14
|
-
| Frame(Diagonal) | frame_diagonal | 2 |
|
|
15
|
-
| input[text] | input_text | 2 |
|
|
16
|
-
| input[radio] | input_radio | 3 |
|
|
17
|
-
| input[checkbox] | input_checkbox | 3 |
|
|
18
|
-
| tabs | tabs | 3 |
|
|
19
|
-
| table | table | 3 |
|
|
20
|
-
|
|
21
|
-
## Data
|
|
22
|
-
|
|
23
|
-
描画するためのデータは三種類あります。
|
|
24
|
-
|
|
25
|
-
### Type 1
|
|
26
|
-
|
|
27
|
-
```
|
|
28
|
-
{
|
|
29
|
-
text: '',
|
|
30
|
-
position: { x:0, y:0, z:0 },
|
|
31
|
-
font: { size: '11px', bold: true }
|
|
32
|
-
},
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
### Type 2
|
|
36
|
-
|
|
37
|
-
```
|
|
38
|
-
{
|
|
39
|
-
element_type: 'frame',
|
|
40
|
-
rectangle: { w: 0, h: 0 },
|
|
41
|
-
position: { x:0, y:0, z:0 },
|
|
42
|
-
labels: [@type1...],
|
|
43
|
-
children: [],
|
|
44
|
-
},
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
### Type 3
|
|
48
|
-
|
|
49
|
-
```
|
|
50
|
-
{
|
|
51
|
-
element_type: '...',
|
|
52
|
-
rectangle: { w: 0, h: 0 },
|
|
53
|
-
position: { x:0, y:0, z:0 },
|
|
54
|
-
labels: [@type1...],
|
|
55
|
-
},
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
#
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
# Copyright
|
|
63
|
-
|
|
64
|
-
Copyright (c) 2018 Satoshi Iwasaki (yanqirenshi@gmail.com)
|
|
65
|
-
|
|
66
|
-
#
|
|
67
|
-
|
|
68
|
-
|
|
1
|
+
# D3.Wireframe
|
|
2
|
+
|
|
3
|
+
ワイヤーフレームをスケッチするためのライブラリです。
|
|
4
|
+
|
|
5
|
+
# Expression
|
|
6
|
+
|
|
7
|
+
以下の要素を描画できます。
|
|
8
|
+
|
|
9
|
+
| Element | element_type | type |
|
|
10
|
+
|-----------------|----------------|------|
|
|
11
|
+
| label | label | 1 |
|
|
12
|
+
| button | button | 2 |
|
|
13
|
+
| Frame(Plain) | frame | 2 |
|
|
14
|
+
| Frame(Diagonal) | frame_diagonal | 2 |
|
|
15
|
+
| input[text] | input_text | 2 |
|
|
16
|
+
| input[radio] | input_radio | 3 |
|
|
17
|
+
| input[checkbox] | input_checkbox | 3 |
|
|
18
|
+
| tabs | tabs | 3 |
|
|
19
|
+
| table | table | 3 |
|
|
20
|
+
|
|
21
|
+
## Data
|
|
22
|
+
|
|
23
|
+
描画するためのデータは三種類あります。
|
|
24
|
+
|
|
25
|
+
### Type 1
|
|
26
|
+
|
|
27
|
+
```
|
|
28
|
+
{
|
|
29
|
+
text: '',
|
|
30
|
+
position: { x:0, y:0, z:0 },
|
|
31
|
+
font: { size: '11px', bold: true }
|
|
32
|
+
},
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### Type 2
|
|
36
|
+
|
|
37
|
+
```
|
|
38
|
+
{
|
|
39
|
+
element_type: 'frame',
|
|
40
|
+
rectangle: { w: 0, h: 0 },
|
|
41
|
+
position: { x:0, y:0, z:0 },
|
|
42
|
+
labels: [@type1...],
|
|
43
|
+
children: [],
|
|
44
|
+
},
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### Type 3
|
|
48
|
+
|
|
49
|
+
```
|
|
50
|
+
{
|
|
51
|
+
element_type: '...',
|
|
52
|
+
rectangle: { w: 0, h: 0 },
|
|
53
|
+
position: { x:0, y:0, z:0 },
|
|
54
|
+
labels: [@type1...],
|
|
55
|
+
},
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
# Author
|
|
59
|
+
|
|
60
|
+
Satoshi Iwasaki (yanqirenshi@gmail.com)
|
|
61
|
+
|
|
62
|
+
# Copyright
|
|
63
|
+
|
|
64
|
+
Copyright (c) 2018-2026 Satoshi Iwasaki (yanqirenshi@gmail.com)
|
|
65
|
+
|
|
66
|
+
# License
|
|
67
|
+
|
|
68
|
+
Licensed under the MIT License.
|
package/dist/Digestion.js
CHANGED
|
@@ -21,11 +21,11 @@ function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r),
|
|
|
21
21
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
22
22
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
23
23
|
// https://yanqirenshi.github.io/D3.Sketch/dist/edge/Drawer.js
|
|
24
|
-
/**
|
|
25
|
-
* 幾何学計算するための Drawer です。
|
|
26
|
-
*
|
|
27
|
-
* @example
|
|
28
|
-
* let drawer = new DrawerHierarchy();
|
|
24
|
+
/**
|
|
25
|
+
* 幾何学計算するための Drawer です。
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* let drawer = new DrawerHierarchy();
|
|
29
29
|
*/
|
|
30
30
|
var DigestionGeometry = exports.DigestionGeometry = /*#__PURE__*/function () {
|
|
31
31
|
function DigestionGeometry() {
|
|
@@ -101,15 +101,15 @@ var DigestionGeometry = exports.DigestionGeometry = /*#__PURE__*/function () {
|
|
|
101
101
|
}
|
|
102
102
|
}]);
|
|
103
103
|
}();
|
|
104
|
-
/**
|
|
105
|
-
* Drawer の共通要素とての Core です。
|
|
106
|
-
* 各 Drawer の要素を整えるメッソッドをまとめているクラスです。
|
|
107
|
-
* いろいろと共通なものがあると思うので。
|
|
108
|
-
* また見通しも良くなるかと。
|
|
109
|
-
* 作る必要があるのかはアレですが。。。
|
|
110
|
-
*
|
|
111
|
-
* @example
|
|
112
|
-
* let drawer = new DrawerHierarchy();
|
|
104
|
+
/**
|
|
105
|
+
* Drawer の共通要素とての Core です。
|
|
106
|
+
* 各 Drawer の要素を整えるメッソッドをまとめているクラスです。
|
|
107
|
+
* いろいろと共通なものがあると思うので。
|
|
108
|
+
* また見通しも良くなるかと。
|
|
109
|
+
* 作る必要があるのかはアレですが。。。
|
|
110
|
+
*
|
|
111
|
+
* @example
|
|
112
|
+
* let drawer = new DrawerHierarchy();
|
|
113
113
|
*/
|
|
114
114
|
var DigestionCore = exports.DigestionCore = /*#__PURE__*/function () {
|
|
115
115
|
function DigestionCore() {
|
|
@@ -212,12 +212,12 @@ var DigestionCore = exports.DigestionCore = /*#__PURE__*/function () {
|
|
|
212
212
|
}
|
|
213
213
|
}]);
|
|
214
214
|
}();
|
|
215
|
-
/**
|
|
216
|
-
* 階層構造のデータの Drawer です。
|
|
217
|
-
* Data の 位置、サイズ を整えます。
|
|
218
|
-
*
|
|
219
|
-
* @example
|
|
220
|
-
* let drawer = new DrawerHierarchy();
|
|
215
|
+
/**
|
|
216
|
+
* 階層構造のデータの Drawer です。
|
|
217
|
+
* Data の 位置、サイズ を整えます。
|
|
218
|
+
*
|
|
219
|
+
* @example
|
|
220
|
+
* let drawer = new DrawerHierarchy();
|
|
221
221
|
*/
|
|
222
222
|
var DigestionHierarchy = exports.DigestionHierarchy = /*#__PURE__*/function (_DigestionCore) {
|
|
223
223
|
function DigestionHierarchy() {
|
package/dist/Drawer.js
CHANGED
|
@@ -21,11 +21,11 @@ function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r),
|
|
|
21
21
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
22
22
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
23
23
|
// https://yanqirenshi.github.io/D3.Sketch/dist/edge/Drawer.js
|
|
24
|
-
/**
|
|
25
|
-
* 幾何学計算するための Drawer です。
|
|
26
|
-
*
|
|
27
|
-
* @example
|
|
28
|
-
* let drawer = new DrawerHierarchy();
|
|
24
|
+
/**
|
|
25
|
+
* 幾何学計算するための Drawer です。
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* let drawer = new DrawerHierarchy();
|
|
29
29
|
*/
|
|
30
30
|
var DrawerGeometry = exports.DrawerGeometry = /*#__PURE__*/function () {
|
|
31
31
|
function DrawerGeometry() {
|
|
@@ -101,15 +101,15 @@ var DrawerGeometry = exports.DrawerGeometry = /*#__PURE__*/function () {
|
|
|
101
101
|
}
|
|
102
102
|
}]);
|
|
103
103
|
}();
|
|
104
|
-
/**
|
|
105
|
-
* Drawer の共通要素とての Core です。
|
|
106
|
-
* 各 Drawer の要素を整えるメッソッドをまとめているクラスです。
|
|
107
|
-
* いろいろと共通なものがあると思うので。
|
|
108
|
-
* また見通しも良くなるかと。
|
|
109
|
-
* 作る必要があるのかはアレですが。。。
|
|
110
|
-
*
|
|
111
|
-
* @example
|
|
112
|
-
* let drawer = new DrawerHierarchy();
|
|
104
|
+
/**
|
|
105
|
+
* Drawer の共通要素とての Core です。
|
|
106
|
+
* 各 Drawer の要素を整えるメッソッドをまとめているクラスです。
|
|
107
|
+
* いろいろと共通なものがあると思うので。
|
|
108
|
+
* また見通しも良くなるかと。
|
|
109
|
+
* 作る必要があるのかはアレですが。。。
|
|
110
|
+
*
|
|
111
|
+
* @example
|
|
112
|
+
* let drawer = new DrawerHierarchy();
|
|
113
113
|
*/
|
|
114
114
|
var Drawer = exports.Drawer = /*#__PURE__*/function () {
|
|
115
115
|
function Drawer() {
|
|
@@ -212,12 +212,12 @@ var Drawer = exports.Drawer = /*#__PURE__*/function () {
|
|
|
212
212
|
}
|
|
213
213
|
}]);
|
|
214
214
|
}();
|
|
215
|
-
/**
|
|
216
|
-
* 階層構造のデータの Drawer です。
|
|
217
|
-
* Data の 位置、サイズ を整えます。
|
|
218
|
-
*
|
|
219
|
-
* @example
|
|
220
|
-
* let drawer = new DrawerHierarchy();
|
|
215
|
+
/**
|
|
216
|
+
* 階層構造のデータの Drawer です。
|
|
217
|
+
* Data の 位置、サイズ を整えます。
|
|
218
|
+
*
|
|
219
|
+
* @example
|
|
220
|
+
* let drawer = new DrawerHierarchy();
|
|
221
221
|
*/
|
|
222
222
|
var DrawerHierarchy = exports.DrawerHierarchy = /*#__PURE__*/function (_Drawer) {
|
|
223
223
|
function DrawerHierarchy() {
|
package/dist/Element.js
CHANGED
|
@@ -42,8 +42,8 @@ var Element = exports["default"] = /*#__PURE__*/function () {
|
|
|
42
42
|
}, {
|
|
43
43
|
key: "elementClass",
|
|
44
44
|
value:
|
|
45
|
-
/* **************************************************************** *
|
|
46
|
-
* Element Class
|
|
45
|
+
/* **************************************************************** *
|
|
46
|
+
* Element Class
|
|
47
47
|
* **************************************************************** */
|
|
48
48
|
function elementClass(data) {
|
|
49
49
|
var element_type = data.element_type;
|
|
@@ -51,8 +51,8 @@ var Element = exports["default"] = /*#__PURE__*/function () {
|
|
|
51
51
|
if (!element_class) throw new Error('Not supported yet. element_type=' + element_type);
|
|
52
52
|
return element_class;
|
|
53
53
|
}
|
|
54
|
-
/* **************************************************************** *
|
|
55
|
-
* Element Class
|
|
54
|
+
/* **************************************************************** *
|
|
55
|
+
* Element Class
|
|
56
56
|
* **************************************************************** */
|
|
57
57
|
}, {
|
|
58
58
|
key: "makeElement",
|
|
@@ -74,19 +74,19 @@ var Element = exports["default"] = /*#__PURE__*/function () {
|
|
|
74
74
|
var element_class = this.elementClass(core);
|
|
75
75
|
return element_class.merge(core, element);
|
|
76
76
|
}
|
|
77
|
-
/* **************************************************************** *
|
|
78
|
-
* Draw
|
|
77
|
+
/* **************************************************************** *
|
|
78
|
+
* Draw
|
|
79
79
|
* **************************************************************** */
|
|
80
80
|
}, {
|
|
81
81
|
key: "draw",
|
|
82
|
-
value: function draw(place, list) {
|
|
82
|
+
value: function draw(place, list, projector) {
|
|
83
83
|
var _iterator = _createForOfIteratorHelper(list),
|
|
84
84
|
_step;
|
|
85
85
|
try {
|
|
86
86
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
87
87
|
var data = _step.value;
|
|
88
88
|
var ec = this.elementClass(data);
|
|
89
|
-
ec.draw(place, data);
|
|
89
|
+
ec.draw(place, data, projector);
|
|
90
90
|
}
|
|
91
91
|
} catch (err) {
|
|
92
92
|
_iterator.e(err);
|
package/dist/ElementButton.js
CHANGED
|
@@ -35,8 +35,8 @@ var ElementButton = exports["default"] = /*#__PURE__*/function (_ElementFounder)
|
|
|
35
35
|
});
|
|
36
36
|
return _this;
|
|
37
37
|
}
|
|
38
|
-
/* **************************************************************** *
|
|
39
|
-
* Data
|
|
38
|
+
/* **************************************************************** *
|
|
39
|
+
* Data
|
|
40
40
|
* **************************************************************** */
|
|
41
41
|
_inherits(ElementButton, _ElementFounder);
|
|
42
42
|
return _createClass(ElementButton, [{
|
|
@@ -73,35 +73,21 @@ var ElementButton = exports["default"] = /*#__PURE__*/function (_ElementFounder)
|
|
|
73
73
|
element._core = core;
|
|
74
74
|
core._element = element;
|
|
75
75
|
}
|
|
76
|
-
/* **************************************************************** *
|
|
77
|
-
* Draw
|
|
76
|
+
/* **************************************************************** *
|
|
77
|
+
* Draw
|
|
78
78
|
* **************************************************************** */
|
|
79
79
|
}, {
|
|
80
80
|
key: "drawAdd",
|
|
81
|
-
value: function drawAdd(place, data) {
|
|
81
|
+
value: function drawAdd(place, data, projector) {
|
|
82
82
|
var _this2 = this;
|
|
83
83
|
var g = place.selectAll("g.".concat(this.name)).data([data], function (d) {
|
|
84
84
|
return d._id;
|
|
85
85
|
}).enter().append('g').attr('class', this.name).attr("transform", function (d) {
|
|
86
|
-
return
|
|
86
|
+
return _this2.groupTransform(d, projector);
|
|
87
87
|
});
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
return d.rectangle.h;
|
|
92
|
-
}).attr('rx', function (d) {
|
|
93
|
-
return d.round || 0;
|
|
94
|
-
}).attr('ry', function (d) {
|
|
95
|
-
return d.round || 0;
|
|
96
|
-
}).attr('fill', function (d) {
|
|
97
|
-
return d.background.color;
|
|
98
|
-
}).attr('stroke', function (d) {
|
|
99
|
-
return _this2.stroke(d);
|
|
100
|
-
}).attr('stroke-width', function (d) {
|
|
101
|
-
return _this2.strokeWidth(d);
|
|
102
|
-
});
|
|
103
|
-
this.icon.draw(g, data);
|
|
104
|
-
this.label.draw(g, data);
|
|
88
|
+
this.drawBase(g, projector);
|
|
89
|
+
this.icon.draw(g, data, projector);
|
|
90
|
+
this.label.draw(g, data, projector);
|
|
105
91
|
}
|
|
106
92
|
}, {
|
|
107
93
|
key: "drawUpdate",
|
|
@@ -119,10 +105,10 @@ var ElementButton = exports["default"] = /*#__PURE__*/function (_ElementFounder)
|
|
|
119
105
|
}
|
|
120
106
|
}, {
|
|
121
107
|
key: "draw",
|
|
122
|
-
value: function draw(place, data) {
|
|
108
|
+
value: function draw(place, data, projector) {
|
|
123
109
|
// this.drawDelete(place, data);
|
|
124
110
|
this.drawUpdate(place, data);
|
|
125
|
-
this.drawAdd(place, data);
|
|
111
|
+
this.drawAdd(place, data, projector);
|
|
126
112
|
}
|
|
127
113
|
}]);
|
|
128
114
|
}(_ElementFounder2["default"]);
|
package/dist/ElementDialog.js
CHANGED
|
@@ -30,8 +30,8 @@ var ElementDialog = exports["default"] = /*#__PURE__*/function (_ElementFounder)
|
|
|
30
30
|
});
|
|
31
31
|
return _this;
|
|
32
32
|
}
|
|
33
|
-
/* **************************************************************** *
|
|
34
|
-
* Data
|
|
33
|
+
/* **************************************************************** *
|
|
34
|
+
* Data
|
|
35
35
|
* **************************************************************** */
|
|
36
36
|
_inherits(ElementDialog, _ElementFounder);
|
|
37
37
|
return _createClass(ElementDialog, [{
|
|
@@ -58,34 +58,20 @@ var ElementDialog = exports["default"] = /*#__PURE__*/function (_ElementFounder)
|
|
|
58
58
|
element.labels = this.label.makeElements(core.labels);
|
|
59
59
|
return element;
|
|
60
60
|
}
|
|
61
|
-
/* **************************************************************** *
|
|
62
|
-
* Draw
|
|
61
|
+
/* **************************************************************** *
|
|
62
|
+
* Draw
|
|
63
63
|
* **************************************************************** */
|
|
64
64
|
}, {
|
|
65
65
|
key: "drawAdd",
|
|
66
|
-
value: function drawAdd(place, data) {
|
|
66
|
+
value: function drawAdd(place, data, projector) {
|
|
67
67
|
var _this2 = this;
|
|
68
68
|
var g = place.selectAll("g.".concat(this.name)).data([data], function (d) {
|
|
69
69
|
return d._id;
|
|
70
70
|
}).enter().append('g').attr('class', this.name).attr("transform", function (d) {
|
|
71
|
-
return
|
|
71
|
+
return _this2.groupTransform(d, projector);
|
|
72
72
|
});
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
}).attr('height', function (d) {
|
|
76
|
-
return d.rectangle.h;
|
|
77
|
-
}).attr('rx', function (d) {
|
|
78
|
-
return d.round || 0;
|
|
79
|
-
}).attr('ry', function (d) {
|
|
80
|
-
return d.round || 0;
|
|
81
|
-
}).attr('fill', function (d) {
|
|
82
|
-
return d.background.color;
|
|
83
|
-
}).attr('stroke', function (d) {
|
|
84
|
-
return _this2.stroke(d);
|
|
85
|
-
}).attr('stroke-width', function (d) {
|
|
86
|
-
return _this2.strokeWidth(d);
|
|
87
|
-
});
|
|
88
|
-
this.label.draw(g, data);
|
|
73
|
+
this.drawBase(g, projector);
|
|
74
|
+
this.label.draw(g, data, projector);
|
|
89
75
|
}
|
|
90
76
|
}, {
|
|
91
77
|
key: "drawUpdate",
|
|
@@ -103,10 +89,10 @@ var ElementDialog = exports["default"] = /*#__PURE__*/function (_ElementFounder)
|
|
|
103
89
|
}
|
|
104
90
|
}, {
|
|
105
91
|
key: "draw",
|
|
106
|
-
value: function draw(place, data) {
|
|
92
|
+
value: function draw(place, data, projector) {
|
|
107
93
|
// this.drawDelete(place, data);
|
|
108
94
|
this.drawUpdate(place, data);
|
|
109
|
-
this.drawAdd(place, data);
|
|
95
|
+
this.drawAdd(place, data, projector);
|
|
110
96
|
}
|
|
111
97
|
}]);
|
|
112
98
|
}(_ElementFounder2["default"]);
|
package/dist/ElementFounder.js
CHANGED
|
@@ -25,8 +25,8 @@ var ElementFounder = exports["default"] = /*#__PURE__*/function () {
|
|
|
25
25
|
this.name = name;
|
|
26
26
|
this.idm = params.idm;
|
|
27
27
|
}
|
|
28
|
-
/* **************************************************************** *
|
|
29
|
-
* Data
|
|
28
|
+
/* **************************************************************** *
|
|
29
|
+
* Data
|
|
30
30
|
* **************************************************************** */
|
|
31
31
|
return _createClass(ElementFounder, [{
|
|
32
32
|
key: "makeTemplateElement",
|
|
@@ -95,9 +95,53 @@ var ElementFounder = exports["default"] = /*#__PURE__*/function () {
|
|
|
95
95
|
}, {
|
|
96
96
|
key: "merge",
|
|
97
97
|
value: function merge(core, element) {}
|
|
98
|
-
/* **************************************************************** *
|
|
99
|
-
* Draw
|
|
98
|
+
/* **************************************************************** *
|
|
99
|
+
* Draw
|
|
100
100
|
* **************************************************************** */
|
|
101
|
+
/**
|
|
102
|
+
* グループの transform。回転ビュー(projector あり)では絶対座標を
|
|
103
|
+
* 射影して描くため translate は使わない。
|
|
104
|
+
*/
|
|
105
|
+
}, {
|
|
106
|
+
key: "groupTransform",
|
|
107
|
+
value: function groupTransform(d, projector) {
|
|
108
|
+
if (projector) return null;
|
|
109
|
+
return "translate(".concat(d.position.x, ", ").concat(d.position.y, ")");
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* 要素の下地(base)を描く。通常はグループ局所座標の rect、
|
|
113
|
+
* 回転ビューでは絶対座標の4頂点を射影した polygon(角丸 round は
|
|
114
|
+
* 回転ビューでは省略される)。fill/stroke は共通で適用し、
|
|
115
|
+
* 追加の属性は返り値の selection に呼び出し側で付ける。
|
|
116
|
+
*/
|
|
117
|
+
}, {
|
|
118
|
+
key: "drawBase",
|
|
119
|
+
value: function drawBase(g, projector) {
|
|
120
|
+
var _this = this;
|
|
121
|
+
var base = null;
|
|
122
|
+
if (projector) {
|
|
123
|
+
base = g.append('polygon').attr('class', 'base').attr('points', function (d) {
|
|
124
|
+
return projector.rectPoints(d.position.x, d.position.y, d.rectangle.w, d.rectangle.h, projector.depthZ(d._depth));
|
|
125
|
+
});
|
|
126
|
+
} else {
|
|
127
|
+
base = g.append('rect').attr('class', 'base').attr('width', function (d) {
|
|
128
|
+
return d.rectangle.w;
|
|
129
|
+
}).attr('height', function (d) {
|
|
130
|
+
return d.rectangle.h;
|
|
131
|
+
}).attr('rx', function (d) {
|
|
132
|
+
return d.round || 0;
|
|
133
|
+
}).attr('ry', function (d) {
|
|
134
|
+
return d.round || 0;
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
return base.attr('fill', function (d) {
|
|
138
|
+
return d.background.color;
|
|
139
|
+
}).attr('stroke', function (d) {
|
|
140
|
+
return _this.stroke(d);
|
|
141
|
+
}).attr('stroke-width', function (d) {
|
|
142
|
+
return _this.strokeWidth(d);
|
|
143
|
+
});
|
|
144
|
+
}
|
|
101
145
|
}, {
|
|
102
146
|
key: "stroke",
|
|
103
147
|
value: function stroke(d) {
|
package/dist/ElementFrame.js
CHANGED
|
@@ -30,8 +30,8 @@ var ElementFrame = exports["default"] = /*#__PURE__*/function (_ElementFounder)
|
|
|
30
30
|
});
|
|
31
31
|
return _this;
|
|
32
32
|
}
|
|
33
|
-
/* **************************************************************** *
|
|
34
|
-
* Data
|
|
33
|
+
/* **************************************************************** *
|
|
34
|
+
* Data
|
|
35
35
|
* **************************************************************** */
|
|
36
36
|
_inherits(ElementFrame, _ElementFounder);
|
|
37
37
|
return _createClass(ElementFrame, [{
|
|
@@ -58,34 +58,20 @@ var ElementFrame = exports["default"] = /*#__PURE__*/function (_ElementFounder)
|
|
|
58
58
|
element.labels = this.label.makeElements(core.labels);
|
|
59
59
|
return element;
|
|
60
60
|
}
|
|
61
|
-
/* **************************************************************** *
|
|
62
|
-
* Draw
|
|
61
|
+
/* **************************************************************** *
|
|
62
|
+
* Draw
|
|
63
63
|
* **************************************************************** */
|
|
64
64
|
}, {
|
|
65
65
|
key: "drawAdd",
|
|
66
|
-
value: function drawAdd(place, data) {
|
|
66
|
+
value: function drawAdd(place, data, projector) {
|
|
67
67
|
var _this2 = this;
|
|
68
68
|
var g = place.selectAll("g.".concat(this.name)).data([data], function (d) {
|
|
69
69
|
return d._id;
|
|
70
70
|
}).enter().append('g').attr('class', this.name).attr("transform", function (d) {
|
|
71
|
-
return
|
|
71
|
+
return _this2.groupTransform(d, projector);
|
|
72
72
|
});
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
}).attr('height', function (d) {
|
|
76
|
-
return d.rectangle.h;
|
|
77
|
-
}).attr('rx', function (d) {
|
|
78
|
-
return d.round || 0;
|
|
79
|
-
}).attr('ry', function (d) {
|
|
80
|
-
return d.round || 0;
|
|
81
|
-
}).attr('fill', function (d) {
|
|
82
|
-
return d.background.color;
|
|
83
|
-
}).attr('stroke', function (d) {
|
|
84
|
-
return _this2.stroke(d);
|
|
85
|
-
}).attr('stroke-width', function (d) {
|
|
86
|
-
return _this2.strokeWidth(d);
|
|
87
|
-
});
|
|
88
|
-
this.label.draw(g, data);
|
|
73
|
+
this.drawBase(g, projector);
|
|
74
|
+
this.label.draw(g, data, projector);
|
|
89
75
|
}
|
|
90
76
|
}, {
|
|
91
77
|
key: "drawUpdate",
|
|
@@ -103,10 +89,10 @@ var ElementFrame = exports["default"] = /*#__PURE__*/function (_ElementFounder)
|
|
|
103
89
|
}
|
|
104
90
|
}, {
|
|
105
91
|
key: "draw",
|
|
106
|
-
value: function draw(place, data) {
|
|
92
|
+
value: function draw(place, data, projector) {
|
|
107
93
|
// this.drawDelete(place, data);
|
|
108
94
|
this.drawUpdate(place, data);
|
|
109
|
-
this.drawAdd(place, data);
|
|
95
|
+
this.drawAdd(place, data, projector);
|
|
110
96
|
}
|
|
111
97
|
}]);
|
|
112
98
|
}(_ElementFounder2["default"]);
|
package/dist/ElementIcon.js
CHANGED
|
@@ -27,8 +27,8 @@ var ElementIcon = exports["default"] = /*#__PURE__*/function (_ElementFounder) {
|
|
|
27
27
|
_this.idm = params.idm;
|
|
28
28
|
return _this;
|
|
29
29
|
}
|
|
30
|
-
/* **************************************************************** *
|
|
31
|
-
* Data
|
|
30
|
+
/* **************************************************************** *
|
|
31
|
+
* Data
|
|
32
32
|
* **************************************************************** */
|
|
33
33
|
_inherits(ElementIcon, _ElementFounder);
|
|
34
34
|
return _createClass(ElementIcon, [{
|
|
@@ -59,20 +59,32 @@ var ElementIcon = exports["default"] = /*#__PURE__*/function (_ElementFounder) {
|
|
|
59
59
|
return _this2.makeElement(icon, parent);
|
|
60
60
|
});
|
|
61
61
|
}
|
|
62
|
-
/* **************************************************************** *
|
|
63
|
-
* Draw
|
|
62
|
+
/* **************************************************************** *
|
|
63
|
+
* Draw
|
|
64
64
|
* **************************************************************** */
|
|
65
|
+
/**
|
|
66
|
+
* アイコン(画像)を描く。SVG の <image> は polygon 化できないため、
|
|
67
|
+
* 回転ビュー(projector あり)では要素の3隅を正確に写す近似 affine
|
|
68
|
+
* 行列で変形する(アイコンは小さいので誤差は実用上見えない)。
|
|
69
|
+
*/
|
|
65
70
|
}, {
|
|
66
71
|
key: "draw",
|
|
67
|
-
value: function draw(place, data) {
|
|
72
|
+
value: function draw(place, data, projector) {
|
|
68
73
|
place.selectAll('image').data(data.icons || [], function (d) {
|
|
69
74
|
return d._id;
|
|
70
75
|
}).enter().append('image').attr('xlink:href', function (d) {
|
|
71
76
|
return d.url;
|
|
77
|
+
}).attr('transform', function (d) {
|
|
78
|
+
if (!projector) return null;
|
|
79
|
+
var x = data.position.x + (d.position && d.position.x || 0);
|
|
80
|
+
var y = data.position.y + (d.position && d.position.y || 0);
|
|
81
|
+
var w = d.size && d.size.w || d.rectangle.w;
|
|
82
|
+
var h = d.size && d.size.h || d.rectangle.h;
|
|
83
|
+
return projector.affine(x, y, w, h, projector.depthZ(data._depth));
|
|
72
84
|
}).attr('x', function (d) {
|
|
73
|
-
return d.position && d.position.x || 0;
|
|
85
|
+
return projector ? 0 : d.position && d.position.x || 0;
|
|
74
86
|
}).attr('y', function (d) {
|
|
75
|
-
return d.position && d.position.y || 0;
|
|
87
|
+
return projector ? 0 : d.position && d.position.y || 0;
|
|
76
88
|
}).attr('width', function (d) {
|
|
77
89
|
return d.size && d.size.w || d.rectangle.w;
|
|
78
90
|
}).attr('height', function (d) {
|