@antv/g 5.0.22-alpha.3 → 5.0.22-alpha.4
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/StyleValueRegistry.d.ts +2 -1
- package/es/css/StyleValueRegistry.js +4 -3
- package/es/css/parser/transform-origin.d.ts +1 -1
- package/es/css/parser/transform-origin.js +2 -2
- 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/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/utils/path.d.ts +1 -1
- package/lib/Canvas.d.ts +0 -3
- package/lib/css/StyleValueRegistry.d.ts +2 -1
- package/lib/css/StyleValueRegistry.js +11 -7
- package/lib/css/parser/transform-origin.d.ts +1 -1
- package/lib/css/parser/transform-origin.js +5 -3
- 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/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/utils/path.d.ts +1 -1
- package/package.json +1 -1
package/es/Canvas.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type { DisplayObject
|
|
1
|
+
import type { DisplayObject } from '../display-objects';
|
|
2
|
+
import type { BaseStyleProps } from '../types';
|
|
2
3
|
import { CSSStyleValue } from './cssom';
|
|
3
4
|
export declare type CSSGlobalKeywords = 'unset' | 'initial' | 'inherit' | '';
|
|
4
5
|
export interface PropertyParseOptions {
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { __decorate, __metadata, __read, __spreadArray } from "tslib";
|
|
2
2
|
import { postConstruct, singleton, GlobalContainer } from 'mana-syringe';
|
|
3
3
|
import { vec3 } from 'gl-matrix';
|
|
4
|
+
import { dirtifyToRoot, GeometryUpdaterFactory } from '../services';
|
|
4
5
|
import { ElementEvent } from '../dom';
|
|
5
|
-
import {
|
|
6
|
-
import { CSSStyleValue, CSSUnitValue } from './cssom';
|
|
7
|
-
import { CSSKeywordValue } from './cssom';
|
|
6
|
+
import { Shape } from '../types';
|
|
7
|
+
import { CSSKeywordValue, CSSStyleValue, CSSUnitValue } from './cssom';
|
|
8
8
|
import { convertPercentUnit } from './parser';
|
|
9
9
|
import { CSSPropertyLocalPosition, CSSPropertyOpacity, CSSPropertyColor, CSSPropertyFilter, CSSPropertyLengthOrPercentage, CSSPropertyLineDash, CSSPropertyShadowBlur, CSSPropertyOffsetPath, CSSPropertyOffsetDistance, CSSPropertyAnchor, CSSPropertyZIndex, CSSPropertyTransform, CSSPropertyTransformOrigin, CSSPropertyPath, CSSPropertyClipPath, CSSPropertyPoints, CSSPropertyText, CSSPropertyTextTransform } from './properties';
|
|
10
10
|
import { formatAttribute } from '../utils';
|
|
11
|
+
import { AABB } from '../shapes';
|
|
11
12
|
/**
|
|
12
13
|
* Blink used them in code generation(css_properties.json5)
|
|
13
14
|
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { isString } from '@antv/util';
|
|
2
|
-
import { CSSUnitValue } from '
|
|
3
|
-
import { parseLengthOrPercentage } from '
|
|
2
|
+
import { CSSUnitValue } from '../cssom';
|
|
3
|
+
import { parseLengthOrPercentage } from './dimension';
|
|
4
4
|
/**
|
|
5
5
|
* @see https://developer.mozilla.org/zh-CN/docs/Web/CSS/transform-origin
|
|
6
6
|
* eg. 'center' 'top left' '50px 50px'
|
package/es/dom/Element.js
CHANGED
|
@@ -6,7 +6,7 @@ import { Cullable, Geometry, Renderable, Transform, Sortable } from '../componen
|
|
|
6
6
|
import { Node } from './Node';
|
|
7
7
|
import { ElementEvent } from './interfaces';
|
|
8
8
|
import { formatAttribute } from '../utils';
|
|
9
|
-
import { MutationEvent } from '
|
|
9
|
+
import { MutationEvent } from './MutationEvent';
|
|
10
10
|
var entityCounter = 0;
|
|
11
11
|
/**
|
|
12
12
|
* Has following capabilities:
|
|
@@ -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 {
|
package/es/dom/Node.js
CHANGED
package/es/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';
|
|
@@ -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;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { __decorate, __metadata, __read, __spreadArray } from "tslib";
|
|
2
2
|
import { singleton, inject } from 'mana-syringe';
|
|
3
|
-
import { toFontString
|
|
3
|
+
import { toFontString } from '../utils';
|
|
4
|
+
import { Rectangle } from '../shapes';
|
|
4
5
|
import { OffscreenCanvasCreator } from './OffscreenCanvasCreator';
|
|
5
6
|
var TEXT_METRICS = {
|
|
6
7
|
MetricsString: '|ÉqÅ',
|
package/es/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;
|
package/lib/Canvas.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type { DisplayObject
|
|
1
|
+
import type { DisplayObject } from '../display-objects';
|
|
2
|
+
import type { BaseStyleProps } from '../types';
|
|
2
3
|
import { CSSStyleValue } from './cssom';
|
|
3
4
|
export declare type CSSGlobalKeywords = 'unset' | 'initial' | 'inherit' | '';
|
|
4
5
|
export interface PropertyParseOptions {
|
|
@@ -11,9 +11,11 @@ var _manaSyringe = require("mana-syringe");
|
|
|
11
11
|
|
|
12
12
|
var _glMatrix = require("gl-matrix");
|
|
13
13
|
|
|
14
|
+
var _services = require("../services");
|
|
15
|
+
|
|
14
16
|
var _dom = require("../dom");
|
|
15
17
|
|
|
16
|
-
var
|
|
18
|
+
var _types = require("../types");
|
|
17
19
|
|
|
18
20
|
var _cssom = require("./cssom");
|
|
19
21
|
|
|
@@ -23,6 +25,8 @@ var _properties = require("./properties");
|
|
|
23
25
|
|
|
24
26
|
var _utils = require("../utils");
|
|
25
27
|
|
|
28
|
+
var _shapes = require("../shapes");
|
|
29
|
+
|
|
26
30
|
/**
|
|
27
31
|
* Blink used them in code generation(css_properties.json5)
|
|
28
32
|
*/
|
|
@@ -750,7 +754,7 @@ var StyleValueRegistry = function () {
|
|
|
750
754
|
StyleValueRegistry.prototype.updateGeometry = function (object) {
|
|
751
755
|
var _a;
|
|
752
756
|
|
|
753
|
-
var geometryUpdaterFactory = _manaSyringe.GlobalContainer.get(
|
|
757
|
+
var geometryUpdaterFactory = _manaSyringe.GlobalContainer.get(_services.GeometryUpdaterFactory);
|
|
754
758
|
|
|
755
759
|
var geometryUpdater = geometryUpdaterFactory(object.nodeName);
|
|
756
760
|
|
|
@@ -758,11 +762,11 @@ var StyleValueRegistry = function () {
|
|
|
758
762
|
var geometry_1 = object.geometry;
|
|
759
763
|
|
|
760
764
|
if (!geometry_1.contentBounds) {
|
|
761
|
-
geometry_1.contentBounds = new
|
|
765
|
+
geometry_1.contentBounds = new _shapes.AABB();
|
|
762
766
|
}
|
|
763
767
|
|
|
764
768
|
if (!geometry_1.renderBounds) {
|
|
765
|
-
geometry_1.renderBounds = new
|
|
769
|
+
geometry_1.renderBounds = new _shapes.AABB();
|
|
766
770
|
}
|
|
767
771
|
|
|
768
772
|
var parsedStyle = object.parsedStyle;
|
|
@@ -785,7 +789,7 @@ var StyleValueRegistry = function () {
|
|
|
785
789
|
_h = _b.offsetZ,
|
|
786
790
|
offsetZ = _h === void 0 ? 0 : _h;
|
|
787
791
|
|
|
788
|
-
if (object.nodeName ===
|
|
792
|
+
if (object.nodeName === _types.Shape.LINE || object.nodeName === _types.Shape.POLYLINE || object.nodeName === _types.Shape.POLYGON || object.nodeName === _types.Shape.PATH) {
|
|
789
793
|
parsedStyle.offsetX = x - (parsedStyle.defX || 0);
|
|
790
794
|
parsedStyle.offsetY = y - (parsedStyle.defY || 0);
|
|
791
795
|
parsedStyle.defX = x;
|
|
@@ -809,7 +813,7 @@ var StyleValueRegistry = function () {
|
|
|
809
813
|
transformOrigin = _j.transformOrigin;
|
|
810
814
|
var anchor = parsedStyle.anchor; // <Text> use textAlign & textBaseline instead of anchor
|
|
811
815
|
|
|
812
|
-
if (object.nodeName ===
|
|
816
|
+
if (object.nodeName === _types.Shape.TEXT) {
|
|
813
817
|
delete parsedStyle.anchor;
|
|
814
818
|
}
|
|
815
819
|
|
|
@@ -881,7 +885,7 @@ var StyleValueRegistry = function () {
|
|
|
881
885
|
usedOriginYValue -= (anchor && anchor[1].value || 0) * geometry_1.contentBounds.halfExtents[1] * 2;
|
|
882
886
|
object.setOrigin(usedOriginXValue, usedOriginYValue);
|
|
883
887
|
object.emit(_dom.ElementEvent.GEOMETRY_BOUNDS_CHANGED, {});
|
|
884
|
-
(0,
|
|
888
|
+
(0, _services.dirtifyToRoot)(object);
|
|
885
889
|
}
|
|
886
890
|
};
|
|
887
891
|
|
|
@@ -7,7 +7,9 @@ exports.parseTransformOrigin = parseTransformOrigin;
|
|
|
7
7
|
|
|
8
8
|
var _util = require("@antv/util");
|
|
9
9
|
|
|
10
|
-
var
|
|
10
|
+
var _cssom = require("../cssom");
|
|
11
|
+
|
|
12
|
+
var _dimension = require("./dimension");
|
|
11
13
|
|
|
12
14
|
/**
|
|
13
15
|
* @see https://developer.mozilla.org/zh-CN/docs/Web/CSS/transform-origin
|
|
@@ -33,9 +35,9 @@ function parseTransformOrigin(value) {
|
|
|
33
35
|
} // eg. center bottom
|
|
34
36
|
|
|
35
37
|
|
|
36
|
-
return [(0,
|
|
38
|
+
return [(0, _dimension.parseLengthOrPercentage)(convertKeyword2Percent(values[0])), (0, _dimension.parseLengthOrPercentage)(convertKeyword2Percent(values[1]))];
|
|
37
39
|
} else {
|
|
38
|
-
return [new
|
|
40
|
+
return [new _cssom.CSSUnitValue(value[0] || 0, 'px'), new _cssom.CSSUnitValue(value[1] || 0, 'px')];
|
|
39
41
|
}
|
|
40
42
|
}
|
|
41
43
|
|
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';
|
|
@@ -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
|
};
|
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;
|