escher.js 0.1.14 → 0.1.17
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/README.md +31 -6
- package/build/escher.js +1602 -308
- package/build/escher.min.js +1 -1
- package/build/escher.module.js +1588 -306
- package/docs/AnimationTimer.html +2 -2
- package/docs/BarGraph.html +5308 -0
- package/docs/BezierCurve.html +44 -40
- package/docs/Box.html +88 -46
- package/docs/Box2.html +175 -27
- package/docs/BoxMask.html +31 -29
- package/docs/Circle.html +88 -46
- package/docs/ColorStyle.html +903 -0
- package/docs/DOM.html +46 -32
- package/docs/EventManager.html +2 -2
- package/docs/FileUtils.html +2 -2
- package/docs/Gauge.html +5956 -0
- package/docs/GradientColorStop.html +382 -0
- package/docs/GradientStyle.html +1018 -0
- package/docs/Graph.html +119 -47
- package/docs/Helpers.html +2 -2
- package/docs/Image.html +56 -34
- package/docs/Key.html +317 -6
- package/docs/Line.html +39 -37
- package/docs/LinearGradientStyle.html +1174 -0
- package/docs/Mask.html +31 -29
- package/docs/Matrix.html +93 -21
- package/docs/MultiLineText.html +42 -40
- package/docs/Node.html +79 -37
- package/docs/NodeConnector.html +43 -41
- package/docs/NodeGraph.html +31 -29
- package/docs/NodeSocket.html +91 -49
- package/docs/Object2D.html +33 -31
- package/docs/Object2D.js.html +5 -2
- package/docs/Path.html +5520 -0
- package/docs/Pattern.html +31 -29
- package/docs/PatternStyle.html +1192 -0
- package/docs/PieChart.html +5670 -0
- package/docs/Pointer.html +2 -2
- package/docs/QuadraticCurve.html +37 -33
- package/docs/RadialGradientStyle.html +1318 -0
- package/docs/Renderer.html +86 -12
- package/docs/Renderer.js.html +23 -2
- package/docs/RoundedBox.html +79 -37
- package/docs/ScatterGraph.html +5378 -0
- package/docs/Style.html +1132 -0
- package/docs/Text.html +43 -41
- package/docs/UUID.html +2 -2
- package/docs/Vector2.html +1319 -224
- package/docs/Viewport.html +189 -29
- package/docs/Viewport.js.html +48 -9
- package/docs/ViewportControls.html +317 -15
- package/docs/controls_ViewportControls.js.html +78 -35
- package/docs/global.html +2 -2
- package/docs/index.html +2 -2
- package/docs/input_Key.js.html +23 -2
- package/docs/input_Pointer.js.html +2 -3
- package/docs/math_Box2.js.html +17 -6
- package/docs/math_Matrix.js.html +18 -11
- package/docs/math_UUID.js.html +2 -2
- package/docs/math_Vector2.js.html +80 -25
- package/docs/objects_BezierCurve.js.html +4 -2
- package/docs/objects_Box.js.html +20 -20
- package/docs/objects_Circle.js.html +20 -20
- package/docs/objects_DOM.js.html +7 -3
- package/docs/objects_Image.js.html +6 -2
- package/docs/objects_Line.js.html +9 -7
- package/docs/objects_MultiLineText.js.html +5 -4
- package/docs/objects_Path.js.html +144 -0
- package/docs/objects_Pattern.js.html +2 -2
- package/docs/objects_QuadraticCurve.js.html +5 -3
- package/docs/objects_RoundedBox.js.html +4 -4
- package/docs/objects_Text.js.html +13 -12
- package/docs/objects_chart_BarGraph.js.html +132 -0
- package/docs/objects_chart_Gauge.js.html +235 -0
- package/docs/objects_chart_Graph.js.html +34 -17
- package/docs/objects_chart_PieChart.js.html +213 -0
- package/docs/objects_chart_ScatterGraph.js.html +158 -0
- package/docs/objects_mask_BoxMask.js.html +2 -2
- package/docs/objects_mask_Mask.js.html +2 -2
- package/docs/objects_node_Node.js.html +2 -2
- package/docs/objects_node_NodeConnector.js.html +7 -2
- package/docs/objects_node_NodeGraph.js.html +2 -2
- package/docs/objects_node_NodeSocket.js.html +4 -2
- package/docs/objects_style_ColorStyle.js.html +96 -0
- package/docs/objects_style_GradientColorStop.js.html +78 -0
- package/docs/objects_style_GradientStyle.js.html +110 -0
- package/docs/objects_style_LinearGradientStyle.js.html +121 -0
- package/docs/objects_style_PatternStyle.js.html +147 -0
- package/docs/objects_style_RadialGradientStyle.js.html +140 -0
- package/docs/objects_style_Style.js.html +134 -0
- package/docs/utils_AnimationTimer.js.html +2 -2
- package/docs/utils_EventManager.js.html +2 -2
- package/docs/utils_FileUtils.js.html +2 -2
- package/docs/utils_Helpers.js.html +2 -2
- package/examples/charts.html +123 -0
- package/examples/physics.html +2 -3
- package/examples/playground.html +19 -3
- package/package.json +6 -6
- package/readme/graphs.png +0 -0
- package/source/Escher.js +14 -1
- package/source/Object2D.js +3 -0
- package/source/Renderer.js +21 -0
- package/source/Viewport.js +46 -7
- package/source/controls/ViewportControls.js +76 -33
- package/source/input/Key.js +21 -0
- package/source/input/Pointer.js +0 -1
- package/source/math/Box2.js +15 -4
- package/source/math/Matrix.js +16 -9
- package/source/math/Vector2.js +78 -23
- package/source/objects/BezierCurve.js +2 -0
- package/source/objects/Box.js +18 -18
- package/source/objects/Circle.js +18 -18
- package/source/objects/DOM.js +5 -1
- package/source/objects/Image.js +4 -0
- package/source/objects/Line.js +7 -5
- package/source/objects/MultiLineText.js +3 -2
- package/source/objects/Path.js +93 -0
- package/source/objects/QuadraticCurve.js +3 -1
- package/source/objects/RoundedBox.js +2 -2
- package/source/objects/Text.js +11 -10
- package/source/objects/chart/BarGraph.js +81 -0
- package/source/objects/chart/Gauge.js +184 -0
- package/source/objects/chart/Graph.js +32 -15
- package/source/objects/chart/PieChart.js +162 -0
- package/source/objects/chart/ScatterGraph.js +107 -0
- package/source/objects/node/NodeConnector.js +5 -0
- package/source/objects/node/NodeSocket.js +2 -0
- package/source/objects/style/ColorStyle.js +45 -0
- package/source/objects/style/GradientColorStop.js +28 -0
- package/source/objects/style/GradientStyle.js +59 -0
- package/source/objects/style/LinearGradientStyle.js +70 -0
- package/source/objects/style/PatternStyle.js +97 -0
- package/source/objects/style/RadialGradientStyle.js +89 -0
- package/source/objects/style/Style.js +83 -0
package/README.md
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
# escher.js
|
|
2
2
|
[](https://badge.fury.io/js/escher.js)[](https://badge.fury.io/gh/tentone%2Fescher.js)[](https://github.com/tentone/escher.js/stargazers)
|
|
3
3
|
|
|
4
|
-
- Web based 2D
|
|
5
|
-
- Entity based diagram build system, entities are stores as a tree.
|
|
4
|
+
- Web based 2D graphics framework on top of the canvas API.
|
|
5
|
+
- Entity based diagram build system, entities are stores as a tree.
|
|
6
|
+
- Interactive 2D graphics with complex pointer events and viewport controls.
|
|
7
|
+
- Compose complex animated canvas objects using parent-children transforms.
|
|
6
8
|
- Extensible using already existing canvas based visualization libs.
|
|
7
9
|
- Base objects boxes, circle, custom shapes, lines, that can be used to compose more complex objects.
|
|
8
10
|
- Support for DOM elements using CSS transforms (Useful for text input and more complex user interaction).
|
|
@@ -11,7 +13,6 @@
|
|
|
11
13
|

|
|
12
14
|
|
|
13
15
|
|
|
14
|
-
|
|
15
16
|
### Examples / Documentation
|
|
16
17
|
|
|
17
18
|
- Sometimes the best way to learn about something is to try it yourself, there are a couple of example in the example folder in the Git repository. They can be used as base for your project.
|
|
@@ -77,11 +78,26 @@ group.add(circle);
|
|
|
77
78
|
var viewport = new Escher.Viewport(canvas);
|
|
78
79
|
|
|
79
80
|
var renderer = new Escher.Renderer(canvas);
|
|
81
|
+
|
|
80
82
|
renderer.createRenderLoop(group, viewport);
|
|
81
83
|
```
|
|
82
84
|
|
|
83
85
|

|
|
84
86
|
|
|
87
|
+
- Alternatively you can create the render loop manually, the render loop should be called at the same rate as the screen is refreshed using the [requestAnimationFrame()](https://developer.mozilla.org/en-US/docs/Web/API/window/requestAnimationFrame) method or a `AnimationTimer` object from the library.
|
|
88
|
+
|
|
89
|
+
```javascript
|
|
90
|
+
var renderer = new Escher.Renderer(canvas);
|
|
91
|
+
var controls = new ViewportControls(viewport);
|
|
92
|
+
|
|
93
|
+
var timer = new AnimationTimer(function()
|
|
94
|
+
{
|
|
95
|
+
controls.update(renderer.pointer);
|
|
96
|
+
renderer.update(group, viewport);
|
|
97
|
+
});
|
|
98
|
+
timer.start();
|
|
99
|
+
```
|
|
100
|
+
|
|
85
101
|
- If the application is not running a full screen canvas there might be some problems with the page scrolling around or showing context menu while interacting to prevent this we can disable/prevent these browser events.
|
|
86
102
|
- In the example we use the `EventManager` object to create and manage these events but we could also create these directly attached to the DOM elements.
|
|
87
103
|
|
|
@@ -186,13 +202,13 @@ class CustomObject extends Escher.Node
|
|
|
186
202
|
serialize(recursive)
|
|
187
203
|
{
|
|
188
204
|
var data = super.serialize(recursive);
|
|
189
|
-
|
|
190
|
-
|
|
205
|
+
data.something = this.something;
|
|
206
|
+
return data;
|
|
191
207
|
}
|
|
192
208
|
|
|
193
209
|
parse(data, root)
|
|
194
210
|
{
|
|
195
|
-
|
|
211
|
+
super.parse(data, root);
|
|
196
212
|
this.something = data.something;
|
|
197
213
|
}
|
|
198
214
|
}
|
|
@@ -212,6 +228,15 @@ constructor()
|
|
|
212
228
|
}
|
|
213
229
|
```
|
|
214
230
|
|
|
231
|
+
- Sometimes it might be necessary to access references to other objects in the group. It is recommended to store these relations by their UUID and rebuilding from the root object.
|
|
232
|
+
|
|
233
|
+
```javascript
|
|
234
|
+
parse(data, root)
|
|
235
|
+
{
|
|
236
|
+
this.someObject = root.getChildByUUID(data.someObject);
|
|
237
|
+
}
|
|
238
|
+
```
|
|
239
|
+
|
|
215
240
|
|
|
216
241
|
|
|
217
242
|
### Pointer events
|