aboutsummaryrefslogtreecommitdiffstats
path: root/src/elements/Polyline.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/elements/Polyline.js')
-rw-r--r--src/elements/Polyline.js27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/elements/Polyline.js b/src/elements/Polyline.js
new file mode 100644
index 0000000..b2cb15b
--- /dev/null
+++ b/src/elements/Polyline.js
@@ -0,0 +1,27 @@
+import { extend, nodeOrNew, register } from '../utils/adopter.js'
+import { registerMethods } from '../utils/methods.js'
+import PointArray from '../types/PointArray.js'
+import Shape from './Shape.js'
+import * as pointed from '../modules/core/pointed.js'
+import * as poly from '../modules/core/poly.js'
+
+export default class Polyline extends Shape {
+ // Initialize node
+ constructor (node) {
+ super(nodeOrNew('polyline', node), Polyline)
+ }
+}
+
+registerMethods({
+ Container: {
+ // Create a wrapped polygon element
+ polyline (p) {
+ // make sure plot is called as a setter
+ return this.put(new Polyline()).plot(p || new PointArray())
+ }
+ }
+})
+
+extend(Polyline, pointed)
+extend(Polyline, poly)
+register(Polyline)