@antv/g-svg 1.1.6 → 1.1.7
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/index.esm.js +70 -179
- package/dist/index.js +70 -179
- package/dist/index.umd.js +1081 -1501
- package/dist/index.umd.min.js +4 -4
- package/package.json +5 -5
package/dist/index.esm.js
CHANGED
|
@@ -11,54 +11,11 @@ export { SVGPicker };
|
|
|
11
11
|
import { inject, singleton, Module } from 'mana-syringe';
|
|
12
12
|
import { __decorate, __metadata } from 'tslib';
|
|
13
13
|
|
|
14
|
-
function
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
function _defineProperties(target, props) {
|
|
21
|
-
for (var i = 0; i < props.length; i++) {
|
|
22
|
-
var descriptor = props[i];
|
|
23
|
-
descriptor.enumerable = descriptor.enumerable || false;
|
|
24
|
-
descriptor.configurable = true;
|
|
25
|
-
if ("value" in descriptor) descriptor.writable = true;
|
|
26
|
-
Object.defineProperty(target, descriptor.key, descriptor);
|
|
27
|
-
}
|
|
28
|
-
}
|
|
14
|
+
function _inheritsLoose(subClass, superClass) {
|
|
15
|
+
subClass.prototype = Object.create(superClass.prototype);
|
|
16
|
+
subClass.prototype.constructor = subClass;
|
|
29
17
|
|
|
30
|
-
|
|
31
|
-
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
32
|
-
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
33
|
-
Object.defineProperty(Constructor, "prototype", {
|
|
34
|
-
writable: false
|
|
35
|
-
});
|
|
36
|
-
return Constructor;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
function _inherits(subClass, superClass) {
|
|
40
|
-
if (typeof superClass !== "function" && superClass !== null) {
|
|
41
|
-
throw new TypeError("Super expression must either be null or a function");
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
subClass.prototype = Object.create(superClass && superClass.prototype, {
|
|
45
|
-
constructor: {
|
|
46
|
-
value: subClass,
|
|
47
|
-
writable: true,
|
|
48
|
-
configurable: true
|
|
49
|
-
}
|
|
50
|
-
});
|
|
51
|
-
Object.defineProperty(subClass, "prototype", {
|
|
52
|
-
writable: false
|
|
53
|
-
});
|
|
54
|
-
if (superClass) _setPrototypeOf(subClass, superClass);
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
function _getPrototypeOf(o) {
|
|
58
|
-
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
|
|
59
|
-
return o.__proto__ || Object.getPrototypeOf(o);
|
|
60
|
-
};
|
|
61
|
-
return _getPrototypeOf(o);
|
|
18
|
+
_setPrototypeOf(subClass, superClass);
|
|
62
19
|
}
|
|
63
20
|
|
|
64
21
|
function _setPrototypeOf(o, p) {
|
|
@@ -70,136 +27,78 @@ function _setPrototypeOf(o, p) {
|
|
|
70
27
|
return _setPrototypeOf(o, p);
|
|
71
28
|
}
|
|
72
29
|
|
|
73
|
-
function _isNativeReflectConstruct() {
|
|
74
|
-
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
|
|
75
|
-
if (Reflect.construct.sham) return false;
|
|
76
|
-
if (typeof Proxy === "function") return true;
|
|
77
|
-
|
|
78
|
-
try {
|
|
79
|
-
Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
|
|
80
|
-
return true;
|
|
81
|
-
} catch (e) {
|
|
82
|
-
return false;
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
function _assertThisInitialized(self) {
|
|
87
|
-
if (self === void 0) {
|
|
88
|
-
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
return self;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
function _possibleConstructorReturn(self, call) {
|
|
95
|
-
if (call && (typeof call === "object" || typeof call === "function")) {
|
|
96
|
-
return call;
|
|
97
|
-
} else if (call !== void 0) {
|
|
98
|
-
throw new TypeError("Derived constructors may only return object or undefined");
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
return _assertThisInitialized(self);
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
function _createSuper(Derived) {
|
|
105
|
-
var hasNativeReflectConstruct = _isNativeReflectConstruct();
|
|
106
|
-
|
|
107
|
-
return function _createSuperInternal() {
|
|
108
|
-
var Super = _getPrototypeOf(Derived),
|
|
109
|
-
result;
|
|
110
|
-
|
|
111
|
-
if (hasNativeReflectConstruct) {
|
|
112
|
-
var NewTarget = _getPrototypeOf(this).constructor;
|
|
113
|
-
|
|
114
|
-
result = Reflect.construct(Super, arguments, NewTarget);
|
|
115
|
-
} else {
|
|
116
|
-
result = Super.apply(this, arguments);
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
return _possibleConstructorReturn(this, result);
|
|
120
|
-
};
|
|
121
|
-
}
|
|
122
|
-
|
|
123
30
|
var SVGContextService = /*#__PURE__*/function () {
|
|
124
31
|
function SVGContextService() {
|
|
125
|
-
_classCallCheck(this, SVGContextService);
|
|
126
|
-
|
|
127
32
|
this.$container = void 0;
|
|
128
33
|
this.$namespace = void 0;
|
|
129
34
|
this.dpr = void 0;
|
|
130
35
|
this.canvasConfig = void 0;
|
|
131
36
|
}
|
|
132
37
|
|
|
133
|
-
|
|
134
|
-
key: "init",
|
|
135
|
-
value: function init() {
|
|
136
|
-
var container = this.canvasConfig.container; // create container
|
|
38
|
+
var _proto = SVGContextService.prototype;
|
|
137
39
|
|
|
138
|
-
|
|
40
|
+
_proto.init = function init() {
|
|
41
|
+
var _this$canvasConfig = this.canvasConfig,
|
|
42
|
+
container = _this$canvasConfig.container,
|
|
43
|
+
doc = _this$canvasConfig.document; // create container
|
|
139
44
|
|
|
140
|
-
|
|
141
|
-
if (!this.$container.style.position) {
|
|
142
|
-
this.$container.style.position = 'relative';
|
|
143
|
-
}
|
|
45
|
+
this.$container = isString(container) ? (doc || document).getElementById(container) : container;
|
|
144
46
|
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
this.$container.appendChild($namespace);
|
|
149
|
-
this.$namespace = $namespace;
|
|
47
|
+
if (this.$container) {
|
|
48
|
+
if (!this.$container.style.position) {
|
|
49
|
+
this.$container.style.position = 'relative';
|
|
150
50
|
}
|
|
151
51
|
|
|
152
|
-
var
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
}, {
|
|
158
|
-
key: "getDomElement",
|
|
159
|
-
value: function getDomElement() {
|
|
160
|
-
return this.$namespace;
|
|
161
|
-
}
|
|
162
|
-
}, {
|
|
163
|
-
key: "getContext",
|
|
164
|
-
value: function getContext() {
|
|
165
|
-
return this.$namespace;
|
|
166
|
-
}
|
|
167
|
-
}, {
|
|
168
|
-
key: "getDPR",
|
|
169
|
-
value: function getDPR() {
|
|
170
|
-
return this.dpr;
|
|
52
|
+
var $namespace = createSVGElement('svg', doc);
|
|
53
|
+
$namespace.setAttribute('width', "" + this.canvasConfig.width);
|
|
54
|
+
$namespace.setAttribute('height', "" + this.canvasConfig.height);
|
|
55
|
+
this.$container.appendChild($namespace);
|
|
56
|
+
this.$namespace = $namespace;
|
|
171
57
|
}
|
|
172
|
-
}, {
|
|
173
|
-
key: "getBoundingClientRect",
|
|
174
|
-
value: function getBoundingClientRect() {
|
|
175
|
-
var _this$$namespace;
|
|
176
58
|
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
59
|
+
var dpr = window.devicePixelRatio || 1;
|
|
60
|
+
dpr = dpr >= 1 ? Math.ceil(dpr) : 1;
|
|
61
|
+
this.dpr = dpr;
|
|
62
|
+
} // @ts-ignore
|
|
63
|
+
;
|
|
64
|
+
|
|
65
|
+
_proto.getDomElement = function getDomElement() {
|
|
66
|
+
return this.$namespace;
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
_proto.getContext = function getContext() {
|
|
70
|
+
return this.$namespace;
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
_proto.getDPR = function getDPR() {
|
|
74
|
+
return this.dpr;
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
_proto.getBoundingClientRect = function getBoundingClientRect() {
|
|
78
|
+
var _this$$namespace;
|
|
79
|
+
|
|
80
|
+
return (_this$$namespace = this.$namespace) === null || _this$$namespace === void 0 ? void 0 : _this$$namespace.getBoundingClientRect();
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
_proto.destroy = function destroy() {
|
|
84
|
+
// destroy context
|
|
85
|
+
if (this.$container && this.$namespace && this.$namespace.parentNode) {
|
|
86
|
+
this.$container.removeChild(this.$namespace);
|
|
186
87
|
}
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
}
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
_proto.resize = function resize(width, height) {
|
|
91
|
+
if (this.$namespace) {
|
|
92
|
+
this.$namespace.setAttribute('width', "" + width);
|
|
93
|
+
this.$namespace.setAttribute('height', "" + height);
|
|
194
94
|
}
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
}
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
_proto.applyCursorStyle = function applyCursorStyle(cursor) {
|
|
98
|
+
if (this.$container) {
|
|
99
|
+
this.$container.style.cursor = cursor;
|
|
201
100
|
}
|
|
202
|
-
}
|
|
101
|
+
};
|
|
203
102
|
|
|
204
103
|
return SVGContextService;
|
|
205
104
|
}();
|
|
@@ -218,37 +117,29 @@ var containerModule = Module(function (register) {
|
|
|
218
117
|
});
|
|
219
118
|
var ContextRegisterPlugin = /*#__PURE__*/function () {
|
|
220
119
|
function ContextRegisterPlugin() {
|
|
221
|
-
_classCallCheck(this, ContextRegisterPlugin);
|
|
222
|
-
|
|
223
120
|
this.name = 'svg-context-register';
|
|
224
121
|
}
|
|
225
122
|
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
}
|
|
236
|
-
}]);
|
|
123
|
+
var _proto = ContextRegisterPlugin.prototype;
|
|
124
|
+
|
|
125
|
+
_proto.init = function init(container) {
|
|
126
|
+
container.load(containerModule, true);
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
_proto.destroy = function destroy(container) {
|
|
130
|
+
container.unload(containerModule);
|
|
131
|
+
};
|
|
237
132
|
|
|
238
133
|
return ContextRegisterPlugin;
|
|
239
134
|
}();
|
|
240
135
|
|
|
241
136
|
var Renderer = /*#__PURE__*/function (_AbstractRenderer) {
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
var _super = _createSuper(Renderer);
|
|
137
|
+
_inheritsLoose(Renderer, _AbstractRenderer);
|
|
245
138
|
|
|
246
139
|
function Renderer(config) {
|
|
247
140
|
var _this;
|
|
248
141
|
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
_this = _super.call(this, config);
|
|
142
|
+
_this = _AbstractRenderer.call(this, config) || this;
|
|
252
143
|
|
|
253
144
|
_this.registerPlugin(new ContextRegisterPlugin());
|
|
254
145
|
|
|
@@ -261,7 +152,7 @@ var Renderer = /*#__PURE__*/function (_AbstractRenderer) {
|
|
|
261
152
|
return _this;
|
|
262
153
|
}
|
|
263
154
|
|
|
264
|
-
return
|
|
155
|
+
return Renderer;
|
|
265
156
|
}(AbstractRenderer);
|
|
266
157
|
|
|
267
158
|
export { Renderer };
|
package/dist/index.js
CHANGED
|
@@ -33,54 +33,11 @@ var DomInteraction__namespace = /*#__PURE__*/_interopNamespace(DomInteraction);
|
|
|
33
33
|
var SVGRenderer__namespace = /*#__PURE__*/_interopNamespace(SVGRenderer);
|
|
34
34
|
var SVGPicker__namespace = /*#__PURE__*/_interopNamespace(SVGPicker);
|
|
35
35
|
|
|
36
|
-
function
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
function _defineProperties(target, props) {
|
|
43
|
-
for (var i = 0; i < props.length; i++) {
|
|
44
|
-
var descriptor = props[i];
|
|
45
|
-
descriptor.enumerable = descriptor.enumerable || false;
|
|
46
|
-
descriptor.configurable = true;
|
|
47
|
-
if ("value" in descriptor) descriptor.writable = true;
|
|
48
|
-
Object.defineProperty(target, descriptor.key, descriptor);
|
|
49
|
-
}
|
|
50
|
-
}
|
|
36
|
+
function _inheritsLoose(subClass, superClass) {
|
|
37
|
+
subClass.prototype = Object.create(superClass.prototype);
|
|
38
|
+
subClass.prototype.constructor = subClass;
|
|
51
39
|
|
|
52
|
-
|
|
53
|
-
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
54
|
-
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
55
|
-
Object.defineProperty(Constructor, "prototype", {
|
|
56
|
-
writable: false
|
|
57
|
-
});
|
|
58
|
-
return Constructor;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
function _inherits(subClass, superClass) {
|
|
62
|
-
if (typeof superClass !== "function" && superClass !== null) {
|
|
63
|
-
throw new TypeError("Super expression must either be null or a function");
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
subClass.prototype = Object.create(superClass && superClass.prototype, {
|
|
67
|
-
constructor: {
|
|
68
|
-
value: subClass,
|
|
69
|
-
writable: true,
|
|
70
|
-
configurable: true
|
|
71
|
-
}
|
|
72
|
-
});
|
|
73
|
-
Object.defineProperty(subClass, "prototype", {
|
|
74
|
-
writable: false
|
|
75
|
-
});
|
|
76
|
-
if (superClass) _setPrototypeOf(subClass, superClass);
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
function _getPrototypeOf(o) {
|
|
80
|
-
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
|
|
81
|
-
return o.__proto__ || Object.getPrototypeOf(o);
|
|
82
|
-
};
|
|
83
|
-
return _getPrototypeOf(o);
|
|
40
|
+
_setPrototypeOf(subClass, superClass);
|
|
84
41
|
}
|
|
85
42
|
|
|
86
43
|
function _setPrototypeOf(o, p) {
|
|
@@ -92,136 +49,78 @@ function _setPrototypeOf(o, p) {
|
|
|
92
49
|
return _setPrototypeOf(o, p);
|
|
93
50
|
}
|
|
94
51
|
|
|
95
|
-
function _isNativeReflectConstruct() {
|
|
96
|
-
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
|
|
97
|
-
if (Reflect.construct.sham) return false;
|
|
98
|
-
if (typeof Proxy === "function") return true;
|
|
99
|
-
|
|
100
|
-
try {
|
|
101
|
-
Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
|
|
102
|
-
return true;
|
|
103
|
-
} catch (e) {
|
|
104
|
-
return false;
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
function _assertThisInitialized(self) {
|
|
109
|
-
if (self === void 0) {
|
|
110
|
-
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
return self;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
function _possibleConstructorReturn(self, call) {
|
|
117
|
-
if (call && (typeof call === "object" || typeof call === "function")) {
|
|
118
|
-
return call;
|
|
119
|
-
} else if (call !== void 0) {
|
|
120
|
-
throw new TypeError("Derived constructors may only return object or undefined");
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
return _assertThisInitialized(self);
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
function _createSuper(Derived) {
|
|
127
|
-
var hasNativeReflectConstruct = _isNativeReflectConstruct();
|
|
128
|
-
|
|
129
|
-
return function _createSuperInternal() {
|
|
130
|
-
var Super = _getPrototypeOf(Derived),
|
|
131
|
-
result;
|
|
132
|
-
|
|
133
|
-
if (hasNativeReflectConstruct) {
|
|
134
|
-
var NewTarget = _getPrototypeOf(this).constructor;
|
|
135
|
-
|
|
136
|
-
result = Reflect.construct(Super, arguments, NewTarget);
|
|
137
|
-
} else {
|
|
138
|
-
result = Super.apply(this, arguments);
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
return _possibleConstructorReturn(this, result);
|
|
142
|
-
};
|
|
143
|
-
}
|
|
144
|
-
|
|
145
52
|
var SVGContextService = /*#__PURE__*/function () {
|
|
146
53
|
function SVGContextService() {
|
|
147
|
-
_classCallCheck(this, SVGContextService);
|
|
148
|
-
|
|
149
54
|
this.$container = void 0;
|
|
150
55
|
this.$namespace = void 0;
|
|
151
56
|
this.dpr = void 0;
|
|
152
57
|
this.canvasConfig = void 0;
|
|
153
58
|
}
|
|
154
59
|
|
|
155
|
-
|
|
156
|
-
key: "init",
|
|
157
|
-
value: function init() {
|
|
158
|
-
var container = this.canvasConfig.container; // create container
|
|
60
|
+
var _proto = SVGContextService.prototype;
|
|
159
61
|
|
|
160
|
-
|
|
62
|
+
_proto.init = function init() {
|
|
63
|
+
var _this$canvasConfig = this.canvasConfig,
|
|
64
|
+
container = _this$canvasConfig.container,
|
|
65
|
+
doc = _this$canvasConfig.document; // create container
|
|
161
66
|
|
|
162
|
-
|
|
163
|
-
if (!this.$container.style.position) {
|
|
164
|
-
this.$container.style.position = 'relative';
|
|
165
|
-
}
|
|
67
|
+
this.$container = g.isString(container) ? (doc || document).getElementById(container) : container;
|
|
166
68
|
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
this.$container.appendChild($namespace);
|
|
171
|
-
this.$namespace = $namespace;
|
|
69
|
+
if (this.$container) {
|
|
70
|
+
if (!this.$container.style.position) {
|
|
71
|
+
this.$container.style.position = 'relative';
|
|
172
72
|
}
|
|
173
73
|
|
|
174
|
-
var
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
}, {
|
|
180
|
-
key: "getDomElement",
|
|
181
|
-
value: function getDomElement() {
|
|
182
|
-
return this.$namespace;
|
|
183
|
-
}
|
|
184
|
-
}, {
|
|
185
|
-
key: "getContext",
|
|
186
|
-
value: function getContext() {
|
|
187
|
-
return this.$namespace;
|
|
188
|
-
}
|
|
189
|
-
}, {
|
|
190
|
-
key: "getDPR",
|
|
191
|
-
value: function getDPR() {
|
|
192
|
-
return this.dpr;
|
|
74
|
+
var $namespace = SVGRenderer.createSVGElement('svg', doc);
|
|
75
|
+
$namespace.setAttribute('width', "" + this.canvasConfig.width);
|
|
76
|
+
$namespace.setAttribute('height', "" + this.canvasConfig.height);
|
|
77
|
+
this.$container.appendChild($namespace);
|
|
78
|
+
this.$namespace = $namespace;
|
|
193
79
|
}
|
|
194
|
-
}, {
|
|
195
|
-
key: "getBoundingClientRect",
|
|
196
|
-
value: function getBoundingClientRect() {
|
|
197
|
-
var _this$$namespace;
|
|
198
80
|
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
81
|
+
var dpr = window.devicePixelRatio || 1;
|
|
82
|
+
dpr = dpr >= 1 ? Math.ceil(dpr) : 1;
|
|
83
|
+
this.dpr = dpr;
|
|
84
|
+
} // @ts-ignore
|
|
85
|
+
;
|
|
86
|
+
|
|
87
|
+
_proto.getDomElement = function getDomElement() {
|
|
88
|
+
return this.$namespace;
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
_proto.getContext = function getContext() {
|
|
92
|
+
return this.$namespace;
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
_proto.getDPR = function getDPR() {
|
|
96
|
+
return this.dpr;
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
_proto.getBoundingClientRect = function getBoundingClientRect() {
|
|
100
|
+
var _this$$namespace;
|
|
101
|
+
|
|
102
|
+
return (_this$$namespace = this.$namespace) === null || _this$$namespace === void 0 ? void 0 : _this$$namespace.getBoundingClientRect();
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
_proto.destroy = function destroy() {
|
|
106
|
+
// destroy context
|
|
107
|
+
if (this.$container && this.$namespace && this.$namespace.parentNode) {
|
|
108
|
+
this.$container.removeChild(this.$namespace);
|
|
208
109
|
}
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
}
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
_proto.resize = function resize(width, height) {
|
|
113
|
+
if (this.$namespace) {
|
|
114
|
+
this.$namespace.setAttribute('width', "" + width);
|
|
115
|
+
this.$namespace.setAttribute('height', "" + height);
|
|
216
116
|
}
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
}
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
_proto.applyCursorStyle = function applyCursorStyle(cursor) {
|
|
120
|
+
if (this.$container) {
|
|
121
|
+
this.$container.style.cursor = cursor;
|
|
223
122
|
}
|
|
224
|
-
}
|
|
123
|
+
};
|
|
225
124
|
|
|
226
125
|
return SVGContextService;
|
|
227
126
|
}();
|
|
@@ -240,37 +139,29 @@ var containerModule = manaSyringe.Module(function (register) {
|
|
|
240
139
|
});
|
|
241
140
|
var ContextRegisterPlugin = /*#__PURE__*/function () {
|
|
242
141
|
function ContextRegisterPlugin() {
|
|
243
|
-
_classCallCheck(this, ContextRegisterPlugin);
|
|
244
|
-
|
|
245
142
|
this.name = 'svg-context-register';
|
|
246
143
|
}
|
|
247
144
|
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
}
|
|
258
|
-
}]);
|
|
145
|
+
var _proto = ContextRegisterPlugin.prototype;
|
|
146
|
+
|
|
147
|
+
_proto.init = function init(container) {
|
|
148
|
+
container.load(containerModule, true);
|
|
149
|
+
};
|
|
150
|
+
|
|
151
|
+
_proto.destroy = function destroy(container) {
|
|
152
|
+
container.unload(containerModule);
|
|
153
|
+
};
|
|
259
154
|
|
|
260
155
|
return ContextRegisterPlugin;
|
|
261
156
|
}();
|
|
262
157
|
|
|
263
158
|
var Renderer = /*#__PURE__*/function (_AbstractRenderer) {
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
var _super = _createSuper(Renderer);
|
|
159
|
+
_inheritsLoose(Renderer, _AbstractRenderer);
|
|
267
160
|
|
|
268
161
|
function Renderer(config) {
|
|
269
162
|
var _this;
|
|
270
163
|
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
_this = _super.call(this, config);
|
|
164
|
+
_this = _AbstractRenderer.call(this, config) || this;
|
|
274
165
|
|
|
275
166
|
_this.registerPlugin(new ContextRegisterPlugin());
|
|
276
167
|
|
|
@@ -283,7 +174,7 @@ var Renderer = /*#__PURE__*/function (_AbstractRenderer) {
|
|
|
283
174
|
return _this;
|
|
284
175
|
}
|
|
285
176
|
|
|
286
|
-
return
|
|
177
|
+
return Renderer;
|
|
287
178
|
}(g.AbstractRenderer);
|
|
288
179
|
|
|
289
180
|
exports.DomInteraction = DomInteraction__namespace;
|