@antv/g 5.0.22-alpha.2 → 5.0.22-alpha.5
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/es/Canvas.d.ts +0 -3
- package/es/css/CSSProperty.d.ts +1 -1
- package/es/css/StyleValueRegistry.d.ts +2 -1
- package/es/css/StyleValueRegistry.js +5 -4
- package/es/css/parser/dimension.d.ts +2 -1
- package/es/css/parser/path.d.ts +1 -1
- package/es/css/parser/transform-origin.d.ts +1 -1
- package/es/css/parser/transform-origin.js +2 -2
- package/es/css/properties/CSSPropertyAnchor.d.ts +4 -2
- package/es/css/properties/CSSPropertyAnchor.js +2 -1
- package/es/css/properties/CSSPropertyClipPath.d.ts +2 -1
- package/es/css/properties/CSSPropertyClipPath.js +1 -1
- package/es/css/properties/CSSPropertyColor.d.ts +3 -2
- package/es/css/properties/CSSPropertyColor.js +1 -1
- package/es/css/properties/CSSPropertyFilter.d.ts +3 -2
- package/es/css/properties/CSSPropertyFilter.js +1 -1
- package/es/css/properties/CSSPropertyLengthOrPercentage.d.ts +4 -2
- package/es/css/properties/CSSPropertyLengthOrPercentage.js +2 -1
- package/es/css/properties/CSSPropertyLineDash.d.ts +4 -2
- package/es/css/properties/CSSPropertyLineDash.js +1 -1
- package/es/css/properties/CSSPropertyLocalPosition.d.ts +4 -2
- package/es/css/properties/CSSPropertyLocalPosition.js +1 -1
- package/es/css/properties/CSSPropertyOffsetDistance.d.ts +4 -2
- package/es/css/properties/CSSPropertyOffsetDistance.js +2 -1
- package/es/css/properties/CSSPropertyOffsetPath.d.ts +2 -1
- package/es/css/properties/CSSPropertyOpacity.d.ts +3 -2
- package/es/css/properties/CSSPropertyOpacity.js +1 -1
- package/es/css/properties/CSSPropertyPath.d.ts +3 -2
- package/es/css/properties/CSSPropertyPath.js +3 -1
- package/es/css/properties/CSSPropertyPoints.d.ts +3 -2
- package/es/css/properties/CSSPropertyPoints.js +1 -1
- package/es/css/properties/CSSPropertyShadowBlur.d.ts +1 -1
- package/es/css/properties/CSSPropertyShadowBlur.js +1 -1
- package/es/css/properties/CSSPropertyText.d.ts +3 -2
- package/es/css/properties/CSSPropertyText.js +1 -1
- package/es/css/properties/CSSPropertyTextTransform.d.ts +2 -1
- package/es/css/properties/CSSPropertyTextTransform.js +1 -1
- package/es/css/properties/CSSPropertyTransform.d.ts +3 -2
- package/es/css/properties/CSSPropertyTransform.js +1 -1
- package/es/css/properties/CSSPropertyTransformOrigin.d.ts +3 -2
- package/es/css/properties/CSSPropertyTransformOrigin.js +1 -1
- package/es/css/properties/CSSPropertyVisibility.d.ts +3 -1
- package/es/css/properties/CSSPropertyZIndex.d.ts +4 -2
- package/es/css/properties/CSSPropertyZIndex.js +1 -1
- package/es/dom/Element.js +1 -1
- package/es/dom/MutationEvent.d.ts +1 -1
- package/es/dom/MutationObserver.d.ts +2 -1
- package/es/dom/MutationObserver.js +1 -1
- package/es/dom/MutationRecord.d.ts +1 -1
- package/es/dom/Node.js +1 -1
- package/es/dom/interfaces.d.ts +2 -1
- package/es/plugins/FrustumCullingStrategy.js +1 -1
- package/es/plugins/PrepareRendererPlugin.d.ts +1 -1
- package/es/services/RenderingService.d.ts +2 -2
- package/es/services/TextService.d.ts +2 -2
- package/es/services/TextService.js +2 -1
- package/es/services/aabb/TextUpdater.d.ts +1 -2
- package/es/types.d.ts +1 -2
- package/es/utils/path.d.ts +1 -1
- package/lib/Canvas.d.ts +0 -3
- package/lib/css/CSSProperty.d.ts +1 -1
- package/lib/css/StyleValueRegistry.d.ts +2 -1
- package/lib/css/StyleValueRegistry.js +14 -8
- package/lib/css/parser/dimension.d.ts +2 -1
- package/lib/css/parser/path.d.ts +1 -1
- package/lib/css/parser/transform-origin.d.ts +1 -1
- package/lib/css/parser/transform-origin.js +5 -3
- package/lib/css/properties/CSSPropertyAnchor.d.ts +4 -2
- package/lib/css/properties/CSSPropertyAnchor.js +5 -3
- package/lib/css/properties/CSSPropertyClipPath.d.ts +2 -1
- package/lib/css/properties/CSSPropertyClipPath.js +2 -2
- package/lib/css/properties/CSSPropertyColor.d.ts +3 -2
- package/lib/css/properties/CSSPropertyColor.js +3 -3
- package/lib/css/properties/CSSPropertyFilter.d.ts +3 -2
- package/lib/css/properties/CSSPropertyFilter.js +2 -2
- package/lib/css/properties/CSSPropertyLengthOrPercentage.d.ts +4 -2
- package/lib/css/properties/CSSPropertyLengthOrPercentage.js +11 -9
- package/lib/css/properties/CSSPropertyLineDash.d.ts +4 -2
- package/lib/css/properties/CSSPropertyLineDash.js +3 -3
- package/lib/css/properties/CSSPropertyLocalPosition.d.ts +4 -2
- package/lib/css/properties/CSSPropertyLocalPosition.js +3 -3
- package/lib/css/properties/CSSPropertyOffsetDistance.d.ts +4 -2
- package/lib/css/properties/CSSPropertyOffsetDistance.js +6 -4
- package/lib/css/properties/CSSPropertyOffsetPath.d.ts +2 -1
- package/lib/css/properties/CSSPropertyOpacity.d.ts +3 -2
- package/lib/css/properties/CSSPropertyOpacity.js +3 -3
- package/lib/css/properties/CSSPropertyPath.d.ts +3 -2
- package/lib/css/properties/CSSPropertyPath.js +9 -5
- package/lib/css/properties/CSSPropertyPoints.d.ts +3 -2
- package/lib/css/properties/CSSPropertyPoints.js +2 -2
- package/lib/css/properties/CSSPropertyShadowBlur.d.ts +1 -1
- package/lib/css/properties/CSSPropertyShadowBlur.js +2 -2
- package/lib/css/properties/CSSPropertyText.d.ts +3 -2
- package/lib/css/properties/CSSPropertyText.js +2 -2
- package/lib/css/properties/CSSPropertyTextTransform.d.ts +2 -1
- package/lib/css/properties/CSSPropertyTextTransform.js +5 -5
- package/lib/css/properties/CSSPropertyTransform.d.ts +3 -2
- package/lib/css/properties/CSSPropertyTransform.js +22 -22
- package/lib/css/properties/CSSPropertyTransformOrigin.d.ts +3 -2
- package/lib/css/properties/CSSPropertyTransformOrigin.js +2 -2
- package/lib/css/properties/CSSPropertyVisibility.d.ts +3 -1
- package/lib/css/properties/CSSPropertyZIndex.d.ts +4 -2
- package/lib/css/properties/CSSPropertyZIndex.js +2 -2
- package/lib/dom/Element.js +3 -3
- package/lib/dom/MutationEvent.d.ts +1 -1
- package/lib/dom/MutationObserver.d.ts +2 -1
- package/lib/dom/MutationObserver.js +11 -11
- package/lib/dom/MutationRecord.d.ts +1 -1
- package/lib/dom/Node.js +4 -4
- package/lib/dom/interfaces.d.ts +2 -1
- package/lib/plugins/FrustumCullingStrategy.js +2 -2
- package/lib/plugins/PrepareRendererPlugin.d.ts +1 -1
- package/lib/services/RenderingService.d.ts +2 -2
- package/lib/services/TextService.d.ts +2 -2
- package/lib/services/TextService.js +5 -3
- package/lib/services/aabb/TextUpdater.d.ts +1 -2
- package/lib/types.d.ts +1 -2
- package/lib/utils/path.d.ts +1 -1
- package/package.json +1 -1
|
@@ -9,10 +9,10 @@ var _tslib = require("tslib");
|
|
|
9
9
|
|
|
10
10
|
var _manaSyringe = require("mana-syringe");
|
|
11
11
|
|
|
12
|
-
var _ = require("../..");
|
|
13
|
-
|
|
14
12
|
var _cssom = require("../cssom");
|
|
15
13
|
|
|
14
|
+
var _parser = require("../parser");
|
|
15
|
+
|
|
16
16
|
// import { uniq } from '@antv/util';
|
|
17
17
|
|
|
18
18
|
/**
|
|
@@ -47,8 +47,8 @@ var _cssom = require("../cssom");
|
|
|
47
47
|
*/
|
|
48
48
|
var CSSPropertyTransform = function () {
|
|
49
49
|
function CSSPropertyTransform() {
|
|
50
|
-
this.parser =
|
|
51
|
-
this.mixer =
|
|
50
|
+
this.parser = _parser.parseTransform;
|
|
51
|
+
this.mixer = _parser.mergeTransforms;
|
|
52
52
|
}
|
|
53
53
|
|
|
54
54
|
CSSPropertyTransform.prototype.calculator = function (name, oldValue, newValue, object) {
|
|
@@ -111,40 +111,40 @@ var CSSPropertyTransform = function () {
|
|
|
111
111
|
}) || [1, 1, 1];
|
|
112
112
|
object.scaleLocal(newScale[0] / oldScale[0], newScale[1] / oldScale[1], newScale[2] / oldScale[2]);
|
|
113
113
|
} else if (t === 'translate') {
|
|
114
|
-
var newTranslation = value && value.d || [
|
|
115
|
-
var oldTranslation = old && old.d || [
|
|
114
|
+
var newTranslation = value && value.d || [_parser.Opx, _parser.Opx];
|
|
115
|
+
var oldTranslation = old && old.d || [_parser.Opx, _parser.Opx];
|
|
116
116
|
object.translateLocal(newTranslation[0].value - oldTranslation[0].value, newTranslation[1].value - oldTranslation[1].value, 0);
|
|
117
117
|
} else if (t === 'translatex') {
|
|
118
|
-
var newTranslation = value && value.d || [
|
|
119
|
-
var oldTranslation = old && old.d || [
|
|
118
|
+
var newTranslation = value && value.d || [_parser.Opx];
|
|
119
|
+
var oldTranslation = old && old.d || [_parser.Opx];
|
|
120
120
|
object.translateLocal(newTranslation[0].value - oldTranslation[0].value, 0, 0);
|
|
121
121
|
} else if (t === 'translatey') {
|
|
122
|
-
var newTranslation = value && value.d || [
|
|
123
|
-
var oldTranslation = old && old.d || [
|
|
122
|
+
var newTranslation = value && value.d || [_parser.Opx];
|
|
123
|
+
var oldTranslation = old && old.d || [_parser.Opx];
|
|
124
124
|
object.translateLocal(0, newTranslation[0].value - oldTranslation[0].value, 0);
|
|
125
125
|
} else if (t === 'translatez') {
|
|
126
|
-
var newTranslation = value && value.d || [
|
|
127
|
-
var oldTranslation = old && old.d || [
|
|
126
|
+
var newTranslation = value && value.d || [_parser.Opx];
|
|
127
|
+
var oldTranslation = old && old.d || [_parser.Opx];
|
|
128
128
|
object.translateLocal(0, 0, newTranslation[0].value - oldTranslation[0].value);
|
|
129
129
|
} else if (t === 'translate3d') {
|
|
130
|
-
var newTranslation = value && value.d || [
|
|
131
|
-
var oldTranslation = old && old.d || [
|
|
130
|
+
var newTranslation = value && value.d || [_parser.Opx, _parser.Opx, _parser.Opx];
|
|
131
|
+
var oldTranslation = old && old.d || [_parser.Opx, _parser.Opx, _parser.Opx];
|
|
132
132
|
object.translateLocal(newTranslation[0].value - oldTranslation[0].value, newTranslation[1].value - oldTranslation[1].value, newTranslation[2].value - oldTranslation[2].value);
|
|
133
133
|
} else if (t === 'rotate') {
|
|
134
|
-
var newAngles = value && value.d || [
|
|
135
|
-
var oldAngles = old && old.d || [
|
|
134
|
+
var newAngles = value && value.d || [_parser.Odeg];
|
|
135
|
+
var oldAngles = old && old.d || [_parser.Odeg];
|
|
136
136
|
object.rotateLocal(0, 0, newAngles[0].value - oldAngles[0].value);
|
|
137
137
|
} else if (t === 'rotatex') {
|
|
138
|
-
var newAngles = value && value.d || [
|
|
139
|
-
var oldAngles = old && old.d || [
|
|
138
|
+
var newAngles = value && value.d || [_parser.Odeg];
|
|
139
|
+
var oldAngles = old && old.d || [_parser.Odeg];
|
|
140
140
|
object.rotateLocal(newAngles[0].value - oldAngles[0].value, 0, 0);
|
|
141
141
|
} else if (t === 'rotatey') {
|
|
142
|
-
var newAngles = value && value.d || [
|
|
143
|
-
var oldAngles = old && old.d || [
|
|
142
|
+
var newAngles = value && value.d || [_parser.Odeg];
|
|
143
|
+
var oldAngles = old && old.d || [_parser.Odeg];
|
|
144
144
|
object.rotateLocal(0, newAngles[0].value - oldAngles[0].value, 0);
|
|
145
145
|
} else if (t === 'rotatez') {
|
|
146
|
-
var newAngles = value && value.d || [
|
|
147
|
-
var oldAngles = old && old.d || [
|
|
146
|
+
var newAngles = value && value.d || [_parser.Odeg];
|
|
147
|
+
var oldAngles = old && old.d || [_parser.Odeg];
|
|
148
148
|
object.rotateLocal(0, 0, newAngles[0].value - oldAngles[0].value);
|
|
149
149
|
} else if (t === 'rotate3d') {// 暂不支持绕指定轴旋转
|
|
150
150
|
// const newAngles = value && value.d || [Odeg, Odeg, Odeg];
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import type { CSSProperty
|
|
2
|
-
import {
|
|
1
|
+
import type { CSSProperty } from '../CSSProperty';
|
|
2
|
+
import type { CSSUnitValue } from '../cssom';
|
|
3
|
+
import { parseTransformOrigin } from '../parser';
|
|
3
4
|
/**
|
|
4
5
|
* @see https://developer.mozilla.org/zh-CN/docs/Web/CSS/transform-origin
|
|
5
6
|
* @example
|
|
@@ -9,7 +9,7 @@ var _tslib = require("tslib");
|
|
|
9
9
|
|
|
10
10
|
var _manaSyringe = require("mana-syringe");
|
|
11
11
|
|
|
12
|
-
var
|
|
12
|
+
var _parser = require("../parser");
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* @see https://developer.mozilla.org/zh-CN/docs/Web/CSS/transform-origin
|
|
@@ -18,7 +18,7 @@ var _ = require("../..");
|
|
|
18
18
|
*/
|
|
19
19
|
var CSSPropertyTransformOrigin = function () {
|
|
20
20
|
function CSSPropertyTransformOrigin() {
|
|
21
|
-
this.parser =
|
|
21
|
+
this.parser = _parser.parseTransformOrigin;
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
CSSPropertyTransformOrigin = (0, _tslib.__decorate)([(0, _manaSyringe.singleton)()], CSSPropertyTransformOrigin);
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import type { CSSProperty
|
|
2
|
-
import {
|
|
1
|
+
import type { CSSProperty } from '../CSSProperty';
|
|
2
|
+
import type { CSSUnitValue } from '../cssom';
|
|
3
|
+
import type { DisplayObject } from '../../display-objects';
|
|
4
|
+
import { parseNumber } from '../parser';
|
|
3
5
|
export declare class CSSPropertyZIndex implements Partial<CSSProperty<CSSUnitValue, CSSUnitValue>> {
|
|
4
6
|
parser: typeof parseNumber;
|
|
5
7
|
postProcessor(object: DisplayObject): void;
|
|
@@ -9,11 +9,11 @@ var _tslib = require("tslib");
|
|
|
9
9
|
|
|
10
10
|
var _manaSyringe = require("mana-syringe");
|
|
11
11
|
|
|
12
|
-
var
|
|
12
|
+
var _parser = require("../parser");
|
|
13
13
|
|
|
14
14
|
var CSSPropertyZIndex = function () {
|
|
15
15
|
function CSSPropertyZIndex() {
|
|
16
|
-
this.parser =
|
|
16
|
+
this.parser = _parser.parseNumber;
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
CSSPropertyZIndex.prototype.postProcessor = function (object) {
|
package/lib/dom/Element.js
CHANGED
|
@@ -21,7 +21,7 @@ var _interfaces = require("./interfaces");
|
|
|
21
21
|
|
|
22
22
|
var _utils = require("../utils");
|
|
23
23
|
|
|
24
|
-
var
|
|
24
|
+
var _MutationEvent = require("./MutationEvent");
|
|
25
25
|
|
|
26
26
|
var entityCounter = 0;
|
|
27
27
|
/**
|
|
@@ -189,7 +189,7 @@ var Element = function (_super) {
|
|
|
189
189
|
// index,
|
|
190
190
|
// });
|
|
191
191
|
|
|
192
|
-
child.dispatchEvent(new
|
|
192
|
+
child.dispatchEvent(new _MutationEvent.MutationEvent(_interfaces.ElementEvent.INSERTED, this, '', '', '', 0, '', ''));
|
|
193
193
|
return child;
|
|
194
194
|
};
|
|
195
195
|
|
|
@@ -220,7 +220,7 @@ var Element = function (_super) {
|
|
|
220
220
|
destroy = true;
|
|
221
221
|
}
|
|
222
222
|
|
|
223
|
-
child.dispatchEvent(new
|
|
223
|
+
child.dispatchEvent(new _MutationEvent.MutationEvent(_interfaces.ElementEvent.REMOVED, this, '', '', '', 0, '', '')); // emit destroy event
|
|
224
224
|
|
|
225
225
|
if (destroy) {
|
|
226
226
|
child.emit(_interfaces.ElementEvent.DESTROY, {});
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type { IElement
|
|
1
|
+
import type { IElement } from './interfaces';
|
|
2
|
+
import type { DisplayObject } from '../display-objects';
|
|
2
3
|
import { MutationEvent } from './MutationEvent';
|
|
3
4
|
import { MutationRecord } from './MutationRecord';
|
|
4
5
|
export declare class Registration {
|
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.MutationObserver = exports.Registration = void 0;
|
|
7
7
|
|
|
8
|
-
var
|
|
8
|
+
var _interfaces = require("./interfaces");
|
|
9
9
|
|
|
10
10
|
var _MutationEvent = require("./MutationEvent");
|
|
11
11
|
|
|
@@ -50,10 +50,10 @@ var Registration = function () {
|
|
|
50
50
|
|
|
51
51
|
Registration.prototype.addListeners_ = function (node) {
|
|
52
52
|
var options = this.options;
|
|
53
|
-
if (options.attributes) node.addEventListener(
|
|
53
|
+
if (options.attributes) node.addEventListener(_interfaces.ElementEvent.ATTR_MODIFIED, this, true); // if (options.characterData) node.addEventListener('DOMCharacterDataModified', this, true);
|
|
54
54
|
|
|
55
|
-
if (options.childList) node.addEventListener(
|
|
56
|
-
if (options.childList || options.subtree) node.addEventListener(
|
|
55
|
+
if (options.childList) node.addEventListener(_interfaces.ElementEvent.INSERTED, this, true);
|
|
56
|
+
if (options.childList || options.subtree) node.addEventListener(_interfaces.ElementEvent.REMOVED, this, true);
|
|
57
57
|
};
|
|
58
58
|
|
|
59
59
|
Registration.prototype.removeListeners = function () {
|
|
@@ -62,10 +62,10 @@ var Registration = function () {
|
|
|
62
62
|
|
|
63
63
|
Registration.prototype.removeListeners_ = function (node) {
|
|
64
64
|
var options = this.options;
|
|
65
|
-
if (options.attributes) node.removeEventListener(
|
|
65
|
+
if (options.attributes) node.removeEventListener(_interfaces.ElementEvent.ATTR_MODIFIED, this, true); // if (options.characterData) node.removeEventListener('DOMCharacterDataModified', this, true);
|
|
66
66
|
|
|
67
|
-
if (options.childList) node.removeEventListener(
|
|
68
|
-
if (options.childList || options.subtree) node.removeEventListener(
|
|
67
|
+
if (options.childList) node.removeEventListener(_interfaces.ElementEvent.INSERTED, this, true);
|
|
68
|
+
if (options.childList || options.subtree) node.removeEventListener(_interfaces.ElementEvent.REMOVED, this, true);
|
|
69
69
|
};
|
|
70
70
|
/**
|
|
71
71
|
* Adds a transient observer on node. The transient observer gets removed
|
|
@@ -113,7 +113,7 @@ var Registration = function () {
|
|
|
113
113
|
var target;
|
|
114
114
|
|
|
115
115
|
switch (e.type) {
|
|
116
|
-
case
|
|
116
|
+
case _interfaces.ElementEvent.ATTR_MODIFIED:
|
|
117
117
|
// http://dom.spec.whatwg.org/#concept-mo-queue-attributes
|
|
118
118
|
var name_1 = e.attrName; // @ts-ignore
|
|
119
119
|
|
|
@@ -158,17 +158,17 @@ var Registration = function () {
|
|
|
158
158
|
// });
|
|
159
159
|
// break;
|
|
160
160
|
|
|
161
|
-
case
|
|
161
|
+
case _interfaces.ElementEvent.REMOVED: // this.addTransientObserver(e.target as IElement);
|
|
162
162
|
// Fall through.
|
|
163
163
|
|
|
164
|
-
case
|
|
164
|
+
case _interfaces.ElementEvent.INSERTED:
|
|
165
165
|
// http://dom.spec.whatwg.org/#concept-mo-queue-childlist
|
|
166
166
|
target = e.relatedNode;
|
|
167
167
|
var changedNode = e.target;
|
|
168
168
|
var addedNodes = void 0;
|
|
169
169
|
var removedNodes = void 0;
|
|
170
170
|
|
|
171
|
-
if (e.type ===
|
|
171
|
+
if (e.type === _interfaces.ElementEvent.INSERTED) {
|
|
172
172
|
addedNodes = [changedNode];
|
|
173
173
|
removedNodes = [];
|
|
174
174
|
} else {
|
package/lib/dom/Node.js
CHANGED
|
@@ -7,7 +7,7 @@ exports.Node = void 0;
|
|
|
7
7
|
|
|
8
8
|
var _tslib = require("tslib");
|
|
9
9
|
|
|
10
|
-
var
|
|
10
|
+
var _types = require("../types");
|
|
11
11
|
|
|
12
12
|
var _EventTarget = require("./EventTarget");
|
|
13
13
|
|
|
@@ -86,7 +86,7 @@ var Node = function (_super) {
|
|
|
86
86
|
|
|
87
87
|
var out = '';
|
|
88
88
|
|
|
89
|
-
if (this.nodeName ===
|
|
89
|
+
if (this.nodeName === _types.Shape.TEXT) {
|
|
90
90
|
// @ts-ignore
|
|
91
91
|
out += this.style.text;
|
|
92
92
|
}
|
|
@@ -95,7 +95,7 @@ var Node = function (_super) {
|
|
|
95
95
|
for (var _b = (0, _tslib.__values)(this.childNodes), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
96
96
|
var child = _c.value;
|
|
97
97
|
|
|
98
|
-
if (child.nodeName ===
|
|
98
|
+
if (child.nodeName === _types.Shape.TEXT) {
|
|
99
99
|
out += child.nodeValue;
|
|
100
100
|
} else {
|
|
101
101
|
out += child.textContent;
|
|
@@ -123,7 +123,7 @@ var Node = function (_super) {
|
|
|
123
123
|
_this.removeChild(child, true);
|
|
124
124
|
});
|
|
125
125
|
|
|
126
|
-
if (this.nodeName ===
|
|
126
|
+
if (this.nodeName === _types.Shape.TEXT) {
|
|
127
127
|
// @ts-ignore
|
|
128
128
|
this.style.text = "" + content;
|
|
129
129
|
} else {// this.appendChild(
|
package/lib/dom/interfaces.d.ts
CHANGED
|
@@ -3,7 +3,8 @@ import type { AnimationTimeline } from './AnimationTimeline';
|
|
|
3
3
|
import type { BaseStyleProps, Shape } from '../types';
|
|
4
4
|
import type { FederatedEvent } from './FederatedEvent';
|
|
5
5
|
import type { CustomElementRegistry } from './CustomElementRegistry';
|
|
6
|
-
import type { CanvasConfig,
|
|
6
|
+
import type { CanvasConfig, InteractivePointerEvent } from '../types';
|
|
7
|
+
import type { DisplayObject } from '../display-objects';
|
|
7
8
|
import type { PointLike } from '../shapes';
|
|
8
9
|
import type { Camera } from '../camera';
|
|
9
10
|
import type { ContextService, EventService, RenderingService } from '../services';
|
|
@@ -17,10 +17,10 @@ var _shapes = require("../shapes");
|
|
|
17
17
|
|
|
18
18
|
var _Camera = require("../camera/Camera");
|
|
19
19
|
|
|
20
|
-
var
|
|
20
|
+
var _types = require("../types");
|
|
21
21
|
|
|
22
22
|
// group is not a 2d shape
|
|
23
|
-
var shape2D = [
|
|
23
|
+
var shape2D = [_types.Shape.CIRCLE, _types.Shape.ELLIPSE, _types.Shape.IMAGE, _types.Shape.RECT, _types.Shape.LINE, _types.Shape.POLYLINE, _types.Shape.POLYGON, _types.Shape.TEXT, _types.Shape.PATH, _types.Shape.HTML];
|
|
24
24
|
|
|
25
25
|
var FrustumCullingStrategy = function () {
|
|
26
26
|
function FrustumCullingStrategy() {}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { RenderingService, RenderingPlugin } from '../services
|
|
1
|
+
import type { RenderingService, RenderingPlugin } from '../services';
|
|
2
2
|
export declare class PrepareRendererPlugin implements RenderingPlugin {
|
|
3
3
|
static tag: string;
|
|
4
4
|
private renderingContext;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Syringe } from 'mana-syringe';
|
|
2
2
|
import { SyncHook, SyncWaterfallHook, AsyncParallelHook, AsyncSeriesWaterfallHook } from 'tapable';
|
|
3
|
-
import type {
|
|
4
|
-
import type { EventPosition, InteractivePointerEvent } from '../types';
|
|
3
|
+
import type { DisplayObject } from '../display-objects';
|
|
4
|
+
import type { CanvasConfig, EventPosition, InteractivePointerEvent } from '../types';
|
|
5
5
|
export interface RenderingPlugin {
|
|
6
6
|
apply: (renderer: RenderingService) => void;
|
|
7
7
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="offscreencanvas" />
|
|
2
|
-
import type { ParsedTextStyleProps } from '
|
|
3
|
-
import { Rectangle } from '
|
|
2
|
+
import type { ParsedTextStyleProps } from '../display-objects';
|
|
3
|
+
import { Rectangle } from '../shapes';
|
|
4
4
|
export interface TextMetrics {
|
|
5
5
|
font: string;
|
|
6
6
|
width: number;
|
|
@@ -9,7 +9,9 @@ var _tslib = require("tslib");
|
|
|
9
9
|
|
|
10
10
|
var _manaSyringe = require("mana-syringe");
|
|
11
11
|
|
|
12
|
-
var
|
|
12
|
+
var _utils = require("../utils");
|
|
13
|
+
|
|
14
|
+
var _shapes = require("../shapes");
|
|
13
15
|
|
|
14
16
|
var _OffscreenCanvasCreator = require("./OffscreenCanvasCreator");
|
|
15
17
|
|
|
@@ -163,7 +165,7 @@ var TextService = function () {
|
|
|
163
165
|
// dropShadow = 0,
|
|
164
166
|
// dropShadowDistance = 0,
|
|
165
167
|
leading = _c === void 0 ? 0 : _c;
|
|
166
|
-
var font = (0,
|
|
168
|
+
var font = (0, _utils.toFontString)(parsedStyle);
|
|
167
169
|
var fontProperties = this.measureFont(font, offscreenCanvas); // fallback in case UA disallow canvas data extraction
|
|
168
170
|
// (toDataURI, getImageData functions)
|
|
169
171
|
|
|
@@ -224,7 +226,7 @@ var TextService = function () {
|
|
|
224
226
|
offsetX -= width;
|
|
225
227
|
}
|
|
226
228
|
|
|
227
|
-
return new
|
|
229
|
+
return new _shapes.Rectangle(offsetX - lineWidth.value / 2, offsetY + i * lineHeight, width + lineWidth.value, lineHeight);
|
|
228
230
|
})
|
|
229
231
|
};
|
|
230
232
|
};
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { GeometryAABBUpdater } from './interfaces';
|
|
2
|
-
import type { ParsedTextStyleProps } from '../../display-objects
|
|
3
|
-
import type { DisplayObject } from '../..';
|
|
2
|
+
import type { DisplayObject, ParsedTextStyleProps } from '../../display-objects';
|
|
4
3
|
export declare class TextUpdater implements GeometryAABBUpdater<ParsedTextStyleProps> {
|
|
5
4
|
private textService;
|
|
6
5
|
private isReadyToMeasure;
|
package/lib/types.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
/// <reference types="offscreencanvas" />
|
|
2
2
|
import type { vec2, vec3 } from 'gl-matrix';
|
|
3
|
-
import type { ParsedPathStyleProps, ParsedPolylineStyleProps } from './display-objects';
|
|
4
|
-
import type { DisplayObject } from './display-objects';
|
|
3
|
+
import type { DisplayObject, ParsedPathStyleProps, ParsedPolylineStyleProps } from './display-objects';
|
|
5
4
|
import type { IRenderer } from './AbstractRenderer';
|
|
6
5
|
import type { CSSGlobalKeywords, CSSGradientValue, CSSKeywordValue, CSSRGB, CSSUnitValue } from './css';
|
|
7
6
|
import { Syringe } from 'mana-syringe';
|
package/lib/utils/path.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { DisplayObject } from '../display-objects
|
|
1
|
+
import type { DisplayObject } from '../display-objects';
|
|
2
2
|
import type { PathCommand } from '../types';
|
|
3
3
|
export declare function equalizeSegments(path1: PathCommand[], path2: PathCommand[], TL?: number): PathCommand[][];
|
|
4
4
|
export declare function getDrawDirection(pathArray: PathCommand[]): boolean;
|