@antv/g 5.0.23-alpha.7 → 5.0.23
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.umd.min.js +3 -3
- package/es/components/Geometry.d.ts +4 -0
- package/es/css/CSS.js +1 -1
- package/es/css/CSSProperty.d.ts +1 -1
- package/es/css/StyleValueRegistry.d.ts +2 -1
- package/es/css/StyleValueRegistry.js +43 -21
- package/es/css/cssom/CSSNumericValue.js +1 -1
- package/es/css/index.d.ts +1 -0
- package/es/css/index.js +1 -0
- package/es/css/interfaces.d.ts +6 -0
- package/es/css/interfaces.js +2 -0
- package/es/css/parser/numeric.d.ts +1 -1
- package/es/css/parser/numeric.js +1 -1
- package/es/css/parser/transform-origin.d.ts +1 -1
- package/es/css/parser/transform-origin.js +1 -1
- package/es/css/parser/transform.d.ts +1 -1
- package/es/css/parser/transform.js +7 -5
- package/es/css/properties/CSSPropertyColor.d.ts +1 -1
- package/es/css/properties/CSSPropertyLengthOrPercentage.d.ts +1 -1
- package/es/display-objects/DisplayObject.d.ts +1 -2
- package/es/display-objects/DisplayObject.js +2 -1
- package/es/dom/Document.js +2 -2
- package/es/global-module.js +4 -7
- package/es/plugins/CullingPlugin.d.ts +1 -0
- package/es/plugins/CullingPlugin.js +8 -3
- package/es/plugins/DirtyCheckPlugin.d.ts +1 -0
- package/es/plugins/DirtyCheckPlugin.js +7 -2
- package/es/plugins/EventPlugin.d.ts +1 -0
- package/es/plugins/EventPlugin.js +14 -9
- package/es/plugins/PrepareRendererPlugin.d.ts +1 -0
- package/es/plugins/PrepareRendererPlugin.js +10 -5
- package/es/services/EventService.js +4 -8
- package/es/services/RenderingService.d.ts +17 -17
- package/es/services/RenderingService.js +25 -22
- package/es/services/SceneGraphService.js +3 -1
- package/es/types.d.ts +6 -1
- package/es/utils/index.d.ts +0 -1
- package/es/utils/index.js +1 -2
- package/es/utils/interpolation.js +1 -1
- package/lib/components/Geometry.d.ts +4 -0
- package/lib/css/CSS.js +2 -2
- package/lib/css/CSSProperty.d.ts +1 -1
- package/lib/css/StyleValueRegistry.d.ts +2 -1
- package/lib/css/StyleValueRegistry.js +50 -24
- package/lib/css/cssom/CSSNumericValue.js +17 -17
- package/lib/css/index.d.ts +1 -0
- package/lib/css/index.js +13 -0
- package/lib/css/interfaces.d.ts +6 -0
- package/lib/css/interfaces.js +12 -0
- package/lib/css/parser/numeric.d.ts +1 -1
- package/lib/css/parser/numeric.js +4 -4
- package/lib/css/parser/transform-origin.d.ts +1 -1
- package/lib/css/parser/transform-origin.js +2 -2
- package/lib/css/parser/transform.d.ts +1 -1
- package/lib/css/parser/transform.js +19 -15
- package/lib/css/properties/CSSPropertyColor.d.ts +1 -1
- package/lib/css/properties/CSSPropertyLengthOrPercentage.d.ts +1 -1
- package/lib/display-objects/DisplayObject.d.ts +1 -2
- package/lib/display-objects/DisplayObject.js +3 -2
- package/lib/dom/Document.js +2 -2
- package/lib/global-module.js +2 -5
- package/lib/plugins/CullingPlugin.d.ts +1 -0
- package/lib/plugins/CullingPlugin.js +7 -3
- package/lib/plugins/DirtyCheckPlugin.d.ts +1 -0
- package/lib/plugins/DirtyCheckPlugin.js +6 -2
- package/lib/plugins/EventPlugin.d.ts +1 -0
- package/lib/plugins/EventPlugin.js +13 -9
- package/lib/plugins/PrepareRendererPlugin.d.ts +1 -0
- package/lib/plugins/PrepareRendererPlugin.js +9 -5
- package/lib/services/EventService.js +4 -8
- package/lib/services/RenderingService.d.ts +17 -17
- package/lib/services/RenderingService.js +25 -22
- package/lib/services/SceneGraphService.js +3 -1
- package/lib/types.d.ts +6 -1
- package/lib/utils/index.d.ts +0 -1
- package/lib/utils/index.js +0 -13
- package/lib/utils/interpolation.js +2 -2
- package/package.json +4 -3
- package/es/utils/hooks.d.ts +0 -280
- package/es/utils/hooks.js +0 -753
- package/lib/utils/hooks.d.ts +0 -280
- package/lib/utils/hooks.js +0 -759
|
@@ -9,4 +9,8 @@ export declare class Geometry {
|
|
|
9
9
|
* including extra rendering effects, eg. shadowBlur filters(drop-shadow, blur)
|
|
10
10
|
*/
|
|
11
11
|
renderBounds: AABB | undefined;
|
|
12
|
+
/**
|
|
13
|
+
* account for `hitArea` & `increasedLineWidthForHitTesting`
|
|
14
|
+
*/
|
|
15
|
+
hitAreaBounds: AABB | undefined;
|
|
12
16
|
}
|
package/es/css/CSS.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { GlobalContainer } from 'mana-syringe';
|
|
2
2
|
import { CSSUnitValue } from './cssom';
|
|
3
|
-
import { StyleValueRegistry } from './
|
|
3
|
+
import { StyleValueRegistry } from './interfaces';
|
|
4
4
|
/**
|
|
5
5
|
* holds useful CSS-related methods.
|
|
6
6
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/CSS
|
package/es/css/CSSProperty.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { IElement } from '../dom';
|
|
2
|
-
import type { StyleValueRegistry } from './
|
|
2
|
+
import type { StyleValueRegistry } from './interfaces';
|
|
3
3
|
export declare type Interpolatable = number | boolean | number[] | boolean[];
|
|
4
4
|
declare type CSSPropertyMixer<Parsed = any, T extends Interpolatable = any> = (left: Parsed, right: Parsed, displayObject: IElement | null) => [T, T, (i: T) => string | any] | undefined;
|
|
5
5
|
declare type CSSPropertyParser<Parsed> = (value: string | any) => Parsed;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { DisplayObject } from '../display-objects';
|
|
2
2
|
import type { BaseStyleProps } from '../types';
|
|
3
3
|
import { CSSStyleValue } from './cssom';
|
|
4
|
+
import { StyleValueRegistry } from './interfaces';
|
|
4
5
|
export declare type CSSGlobalKeywords = 'unset' | 'initial' | 'inherit' | '';
|
|
5
6
|
export interface PropertyParseOptions {
|
|
6
7
|
skipUpdateAttribute: boolean;
|
|
@@ -65,7 +66,7 @@ export interface PropertyMetadata {
|
|
|
65
66
|
* Blink used them in code generation(css_properties.json5)
|
|
66
67
|
*/
|
|
67
68
|
export declare const BUILT_IN_PROPERTIES: PropertyMetadata[];
|
|
68
|
-
export declare class StyleValueRegistry {
|
|
69
|
+
export declare class DefaultStyleValueRegistry implements StyleValueRegistry {
|
|
69
70
|
/**
|
|
70
71
|
* need recalc later
|
|
71
72
|
*/
|
|
@@ -1,7 +1,8 @@
|
|
|
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 {
|
|
4
|
+
import { GeometryUpdaterFactory } from '../services/aabb/interfaces';
|
|
5
|
+
import { dirtifyToRoot } from '../services/SceneGraphService';
|
|
5
6
|
import { ElementEvent } from '../dom';
|
|
6
7
|
import { Shape } from '../types';
|
|
7
8
|
import { CSSKeywordValue, CSSStyleValue, CSSUnitValue } from './cssom';
|
|
@@ -9,6 +10,7 @@ import { convertPercentUnit } from './parser';
|
|
|
9
10
|
import { CSSPropertyLocalPosition, CSSPropertyOpacity, CSSPropertyColor, CSSPropertyFilter, CSSPropertyLengthOrPercentage, CSSPropertyLineDash, CSSPropertyShadowBlur, CSSPropertyOffsetPath, CSSPropertyOffsetDistance, CSSPropertyAnchor, CSSPropertyZIndex, CSSPropertyTransform, CSSPropertyTransformOrigin, CSSPropertyPath, CSSPropertyClipPath, CSSPropertyPoints, CSSPropertyText, CSSPropertyTextTransform } from './properties';
|
|
10
11
|
import { formatAttribute } from '../utils';
|
|
11
12
|
import { AABB } from '../shapes';
|
|
13
|
+
import { StyleValueRegistry } from './interfaces';
|
|
12
14
|
export var PropertySyntax = {
|
|
13
15
|
COLOR: '<color>',
|
|
14
16
|
PAINT: '<paint>',
|
|
@@ -135,6 +137,14 @@ export var BUILT_IN_PROPERTIES = [{
|
|
|
135
137
|
alias: ['strokeWidth'],
|
|
136
138
|
syntax: PropertySyntax.LENGTH_PERCENTAGE,
|
|
137
139
|
handler: CSSPropertyLengthOrPercentage
|
|
140
|
+
}, {
|
|
141
|
+
name: 'increasedLineWidthForHitTesting',
|
|
142
|
+
inherited: true,
|
|
143
|
+
defaultValue: '0',
|
|
144
|
+
layoutDependent: true,
|
|
145
|
+
alias: ['lineAppendWidth'],
|
|
146
|
+
syntax: PropertySyntax.LENGTH_PERCENTAGE,
|
|
147
|
+
handler: CSSPropertyLengthOrPercentage
|
|
138
148
|
}, {
|
|
139
149
|
name: 'lineJoin',
|
|
140
150
|
inherited: true,
|
|
@@ -411,10 +421,10 @@ export var BUILT_IN_PROPERTIES = [{
|
|
|
411
421
|
layoutDependent: true
|
|
412
422
|
}];
|
|
413
423
|
|
|
414
|
-
var
|
|
424
|
+
var DefaultStyleValueRegistry =
|
|
415
425
|
/** @class */
|
|
416
426
|
function () {
|
|
417
|
-
function
|
|
427
|
+
function DefaultStyleValueRegistry() {
|
|
418
428
|
/**
|
|
419
429
|
* need recalc later
|
|
420
430
|
*/
|
|
@@ -450,7 +460,7 @@ function () {
|
|
|
450
460
|
// > = {};
|
|
451
461
|
|
|
452
462
|
|
|
453
|
-
|
|
463
|
+
DefaultStyleValueRegistry.prototype.init = function () {
|
|
454
464
|
var _this = this;
|
|
455
465
|
|
|
456
466
|
BUILT_IN_PROPERTIES.forEach(function (property) {
|
|
@@ -458,7 +468,7 @@ function () {
|
|
|
458
468
|
});
|
|
459
469
|
};
|
|
460
470
|
|
|
461
|
-
|
|
471
|
+
DefaultStyleValueRegistry.prototype.registerMetadata = function (metadata) {
|
|
462
472
|
var _this = this;
|
|
463
473
|
|
|
464
474
|
__spreadArray([metadata.name], __read(metadata.alias || []), false).forEach(function (name) {
|
|
@@ -466,7 +476,7 @@ function () {
|
|
|
466
476
|
});
|
|
467
477
|
};
|
|
468
478
|
|
|
469
|
-
|
|
479
|
+
DefaultStyleValueRegistry.prototype.getMetadata = function (name) {
|
|
470
480
|
return this.cache[name];
|
|
471
481
|
};
|
|
472
482
|
/**
|
|
@@ -480,7 +490,7 @@ function () {
|
|
|
480
490
|
*/
|
|
481
491
|
|
|
482
492
|
|
|
483
|
-
|
|
493
|
+
DefaultStyleValueRegistry.prototype.processProperties = function (object, attributes, options) {
|
|
484
494
|
var _this = this;
|
|
485
495
|
|
|
486
496
|
if (options === void 0) {
|
|
@@ -561,7 +571,7 @@ function () {
|
|
|
561
571
|
*/
|
|
562
572
|
|
|
563
573
|
|
|
564
|
-
|
|
574
|
+
DefaultStyleValueRegistry.prototype.parseProperty = function (name, value) {
|
|
565
575
|
var metadata = this.getMetadata(name);
|
|
566
576
|
var computed = value;
|
|
567
577
|
|
|
@@ -597,7 +607,7 @@ function () {
|
|
|
597
607
|
*/
|
|
598
608
|
|
|
599
609
|
|
|
600
|
-
|
|
610
|
+
DefaultStyleValueRegistry.prototype.computeProperty = function (name, computed, object) {
|
|
601
611
|
var metadata = this.getMetadata(name);
|
|
602
612
|
var isDocumentElement = object.id === 'g-root';
|
|
603
613
|
var used = computed instanceof CSSStyleValue ? computed.clone() : computed;
|
|
@@ -661,7 +671,7 @@ function () {
|
|
|
661
671
|
return false;
|
|
662
672
|
};
|
|
663
673
|
|
|
664
|
-
|
|
674
|
+
DefaultStyleValueRegistry.prototype.postProcessProperty = function (name, object) {
|
|
665
675
|
var metadata = this.getMetadata(name);
|
|
666
676
|
|
|
667
677
|
if (metadata && metadata.handler) {
|
|
@@ -673,7 +683,7 @@ function () {
|
|
|
673
683
|
}
|
|
674
684
|
};
|
|
675
685
|
|
|
676
|
-
|
|
686
|
+
DefaultStyleValueRegistry.prototype.isPropertyResolved = function (object, name) {
|
|
677
687
|
if (!this.unresolvedProperties[object.entity] || this.unresolvedProperties[object.entity].length === 0) {
|
|
678
688
|
return true;
|
|
679
689
|
}
|
|
@@ -685,7 +695,7 @@ function () {
|
|
|
685
695
|
*/
|
|
686
696
|
|
|
687
697
|
|
|
688
|
-
|
|
698
|
+
DefaultStyleValueRegistry.prototype.addUnresolveProperty = function (object, name) {
|
|
689
699
|
if (!this.unresolvedProperties[object.entity]) {
|
|
690
700
|
this.unresolvedProperties[object.entity] = [];
|
|
691
701
|
}
|
|
@@ -695,7 +705,7 @@ function () {
|
|
|
695
705
|
}
|
|
696
706
|
};
|
|
697
707
|
|
|
698
|
-
|
|
708
|
+
DefaultStyleValueRegistry.prototype.tryToResolveProperty = function (object, name, options) {
|
|
699
709
|
if (options === void 0) {
|
|
700
710
|
options = {};
|
|
701
711
|
}
|
|
@@ -719,7 +729,7 @@ function () {
|
|
|
719
729
|
return false;
|
|
720
730
|
};
|
|
721
731
|
|
|
722
|
-
|
|
732
|
+
DefaultStyleValueRegistry.prototype.recalc = function (object) {
|
|
723
733
|
var properties = this.unresolvedProperties[object.entity];
|
|
724
734
|
|
|
725
735
|
if (properties && properties.length) {
|
|
@@ -737,7 +747,7 @@ function () {
|
|
|
737
747
|
*/
|
|
738
748
|
|
|
739
749
|
|
|
740
|
-
|
|
750
|
+
DefaultStyleValueRegistry.prototype.updateGeometry = function (object) {
|
|
741
751
|
var _a;
|
|
742
752
|
|
|
743
753
|
var geometryUpdaterFactory = GlobalContainer.get(GeometryUpdaterFactory);
|
|
@@ -754,6 +764,10 @@ function () {
|
|
|
754
764
|
geometry_1.renderBounds = new AABB();
|
|
755
765
|
}
|
|
756
766
|
|
|
767
|
+
if (!geometry_1.hitAreaBounds) {
|
|
768
|
+
geometry_1.hitAreaBounds = new AABB();
|
|
769
|
+
}
|
|
770
|
+
|
|
757
771
|
var parsedStyle = object.parsedStyle;
|
|
758
772
|
|
|
759
773
|
var _b = geometryUpdater.update(parsedStyle, object),
|
|
@@ -791,6 +805,7 @@ function () {
|
|
|
791
805
|
|
|
792
806
|
var _j = parsedStyle,
|
|
793
807
|
lineWidth = _j.lineWidth,
|
|
808
|
+
increasedLineWidthForHitTesting = _j.increasedLineWidthForHitTesting,
|
|
794
809
|
shadowColor = _j.shadowColor,
|
|
795
810
|
_k = _j.filter,
|
|
796
811
|
filter = _k === void 0 ? [] : _k,
|
|
@@ -808,9 +823,14 @@ function () {
|
|
|
808
823
|
if (lineWidth) {
|
|
809
824
|
// append border
|
|
810
825
|
vec3.add(halfExtents, halfExtents, vec3.fromValues(lineWidth.value / 2, lineWidth.value / 2, 0));
|
|
826
|
+
geometry_1.renderBounds.update(center, halfExtents);
|
|
811
827
|
}
|
|
812
828
|
|
|
813
|
-
|
|
829
|
+
if (increasedLineWidthForHitTesting) {
|
|
830
|
+
vec3.add(halfExtents, halfExtents, vec3.fromValues(increasedLineWidthForHitTesting.value / 2, increasedLineWidthForHitTesting.value / 2, 0));
|
|
831
|
+
geometry_1.hitAreaBounds.update(center, halfExtents);
|
|
832
|
+
} // account for shadow, only support constant value now
|
|
833
|
+
|
|
814
834
|
|
|
815
835
|
if (shadowColor) {
|
|
816
836
|
var _l = geometry_1.renderBounds,
|
|
@@ -872,7 +892,7 @@ function () {
|
|
|
872
892
|
}
|
|
873
893
|
};
|
|
874
894
|
|
|
875
|
-
|
|
895
|
+
DefaultStyleValueRegistry.prototype.isPropertyInheritable = function (name) {
|
|
876
896
|
var metadata = this.getMetadata(name);
|
|
877
897
|
|
|
878
898
|
if (!metadata) {
|
|
@@ -882,10 +902,12 @@ function () {
|
|
|
882
902
|
return metadata.inherited;
|
|
883
903
|
};
|
|
884
904
|
|
|
885
|
-
__decorate([postConstruct(), __metadata("design:type", Function), __metadata("design:paramtypes", []), __metadata("design:returntype", void 0)],
|
|
905
|
+
__decorate([postConstruct(), __metadata("design:type", Function), __metadata("design:paramtypes", []), __metadata("design:returntype", void 0)], DefaultStyleValueRegistry.prototype, "init", null);
|
|
886
906
|
|
|
887
|
-
|
|
888
|
-
|
|
907
|
+
DefaultStyleValueRegistry = __decorate([singleton({
|
|
908
|
+
token: StyleValueRegistry
|
|
909
|
+
})], DefaultStyleValueRegistry);
|
|
910
|
+
return DefaultStyleValueRegistry;
|
|
889
911
|
}();
|
|
890
912
|
|
|
891
|
-
export {
|
|
913
|
+
export { DefaultStyleValueRegistry };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { __assign, __extends, __read, __spreadArray, __values } from "tslib";
|
|
2
|
-
import { DCHECK, DCHECK_EQ, DCHECK_NE } from '../../utils';
|
|
2
|
+
import { DCHECK, DCHECK_EQ, DCHECK_NE } from '../../utils/assert';
|
|
3
3
|
import { CSSMathOperator } from './CSSMathOperator';
|
|
4
4
|
import { CSSStyleValue, CSSStyleValueType } from './CSSStyleValue';
|
|
5
5
|
import { Nested, ParenLess, UnitType } from './types'; // https://drafts.css-houdini.org/css-typed-om/#enumdef-cssnumericbasetype
|
package/es/css/index.d.ts
CHANGED
package/es/css/index.js
CHANGED
package/es/css/parser/numeric.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { clamp, isString } from '../../utils';
|
|
2
|
-
import { CSSUnitValue } from '../cssom';
|
|
2
|
+
import { CSSUnitValue } from '../cssom/CSSNumericValue';
|
|
3
3
|
export function numberToString(x) {
|
|
4
4
|
// scale(0.00000001) -> scale(0)
|
|
5
5
|
// return x.toFixed(6).replace(/0+$/, '').replace(/\.$/, '');
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { isString } from '../../utils';
|
|
2
|
-
import { CSSUnitValue } from '../cssom';
|
|
2
|
+
import { CSSUnitValue } from '../cssom/CSSNumericValue';
|
|
3
3
|
import { parseLengthOrPercentage } from './dimension';
|
|
4
4
|
/**
|
|
5
5
|
* @see https://developer.mozilla.org/zh-CN/docs/Web/CSS/transform-origin
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import { UnitType
|
|
1
|
+
import { UnitType } from '../cssom/types';
|
|
2
|
+
import { CSSUnitValue, Opx, Odeg } from '../cssom/CSSNumericValue';
|
|
2
3
|
import { mergeDimensions, parseAngle, parseLength, parseLengthOrPercentage } from './dimension';
|
|
3
4
|
import { mergeNumbers, parseNumber } from './numeric';
|
|
5
|
+
import { CSS } from '../CSS';
|
|
4
6
|
var _ = null;
|
|
5
7
|
|
|
6
8
|
function cast(pattern) {
|
|
@@ -27,10 +29,10 @@ var transformFunctions = {
|
|
|
27
29
|
rotatez: ['A'],
|
|
28
30
|
rotate3d: ['NNNA'],
|
|
29
31
|
// perspective: ['L'],
|
|
30
|
-
scale: ['Nn', cast([_, _,
|
|
31
|
-
scalex: ['N', cast([_,
|
|
32
|
-
scaley: ['N', cast([
|
|
33
|
-
scalez: ['N', cast([
|
|
32
|
+
scale: ['Nn', cast([_, _, CSS.number(1)]), id],
|
|
33
|
+
scalex: ['N', cast([_, CSS.number(1), CSS.number(1)]), cast([_, CSS.number(1)])],
|
|
34
|
+
scaley: ['N', cast([CSS.number(1), _, CSS.number(1)]), cast([CSS.number(1), _])],
|
|
35
|
+
scalez: ['N', cast([CSS.number(1), CSS.number(1), _])],
|
|
34
36
|
scale3d: ['NNN', id],
|
|
35
37
|
// skew: ['Aa', null, id],
|
|
36
38
|
// skewx: ['A', null, cast([_, Odeg])],
|
|
@@ -3,7 +3,7 @@ import type { DisplayObject } from '../../display-objects';
|
|
|
3
3
|
import { parseColor, mergeColors } from '../parser';
|
|
4
4
|
import type { CSSGradientValue } from '../cssom';
|
|
5
5
|
import { CSSKeywordValue, CSSRGB } from '../cssom';
|
|
6
|
-
import type { StyleValueRegistry } from '../
|
|
6
|
+
import type { StyleValueRegistry } from '../interfaces';
|
|
7
7
|
/**
|
|
8
8
|
* opacity
|
|
9
9
|
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CSSUnitValue } from '../cssom';
|
|
2
2
|
import { mergeDimensions } from '../parser';
|
|
3
|
-
import type { StyleValueRegistry } from '../
|
|
3
|
+
import type { StyleValueRegistry } from '../interfaces';
|
|
4
4
|
import type { DisplayObject } from '../../display-objects';
|
|
5
5
|
import type { CSSProperty } from '../CSSProperty';
|
|
6
6
|
/**
|
|
@@ -5,7 +5,6 @@ import { Element } from '../dom/Element';
|
|
|
5
5
|
import type { DisplayObjectConfig, IChildNode } from '../dom/interfaces';
|
|
6
6
|
import type { BaseStyleProps, ParsedBaseStyleProps } from '../types';
|
|
7
7
|
import type { PropertyParseOptions } from '../css/StyleValueRegistry';
|
|
8
|
-
import { StyleValueRegistry } from '../css/StyleValueRegistry';
|
|
9
8
|
/**
|
|
10
9
|
* prototype chains: DisplayObject -> Element -> Node -> EventTarget
|
|
11
10
|
*
|
|
@@ -29,7 +28,7 @@ export declare class DisplayObject<StyleProps extends BaseStyleProps = any, Pars
|
|
|
29
28
|
* contains style props in constructor's params, eg. fill, stroke...
|
|
30
29
|
*/
|
|
31
30
|
config: DisplayObjectConfig<StyleProps>;
|
|
32
|
-
styleValueRegistry:
|
|
31
|
+
styleValueRegistry: any;
|
|
33
32
|
/**
|
|
34
33
|
* push to active animations after calling `animate()`
|
|
35
34
|
*/
|
|
@@ -10,7 +10,7 @@ import { createVec3, decompose, formatAttribute, fromRotationTranslationScale, g
|
|
|
10
10
|
import { dirtifyToRoot } from '../services';
|
|
11
11
|
import { MutationEvent } from '../dom/MutationEvent';
|
|
12
12
|
import { Rectangle } from '../shapes';
|
|
13
|
-
import { StyleValueRegistry } from '../css/
|
|
13
|
+
import { StyleValueRegistry } from '../css/interfaces';
|
|
14
14
|
import { CSSUnitValue } from '../css';
|
|
15
15
|
var DEFAULT_STYLE_PROPS = {
|
|
16
16
|
x: '',
|
|
@@ -27,6 +27,7 @@ var DEFAULT_STYLE_PROPS = {
|
|
|
27
27
|
pointerEvents: '',
|
|
28
28
|
lineCap: '',
|
|
29
29
|
lineJoin: '',
|
|
30
|
+
increasedLineWidthForHitTesting: '0',
|
|
30
31
|
fontSize: '',
|
|
31
32
|
fontFamily: '',
|
|
32
33
|
fontStyle: '',
|
package/es/dom/Document.js
CHANGED
|
@@ -146,7 +146,7 @@ function (_super) {
|
|
|
146
146
|
}), clientX = _c.x, clientY = _c.y;
|
|
147
147
|
return [4
|
|
148
148
|
/*yield*/
|
|
149
|
-
, this.defaultView.getRenderingService().hooks.pick.
|
|
149
|
+
, this.defaultView.getRenderingService().hooks.pick.promise({
|
|
150
150
|
topmost: true,
|
|
151
151
|
position: {
|
|
152
152
|
x: x,
|
|
@@ -200,7 +200,7 @@ function (_super) {
|
|
|
200
200
|
}), clientX = _c.x, clientY = _c.y;
|
|
201
201
|
return [4
|
|
202
202
|
/*yield*/
|
|
203
|
-
, this.defaultView.getRenderingService().hooks.pick.
|
|
203
|
+
, this.defaultView.getRenderingService().hooks.pick.promise({
|
|
204
204
|
topmost: false,
|
|
205
205
|
position: {
|
|
206
206
|
x: x,
|
package/es/global-module.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Module, injectable, decorate } from 'mana-syringe';
|
|
2
2
|
import { EventEmitter } from 'eventemitter3';
|
|
3
3
|
import { DisplayObjectPool } from './DisplayObjectPool';
|
|
4
|
-
import { CircleUpdater, EllipseUpdater, GeometryAABBUpdater, GeometryUpdaterFactory, LineUpdater, PathUpdater, PolylineUpdater, RectUpdater, TextUpdater, TextService, OffscreenCanvasCreator, DefaultSceneGraphService,
|
|
5
|
-
import { LayoutRegistry,
|
|
4
|
+
import { CircleUpdater, EllipseUpdater, GeometryAABBUpdater, GeometryUpdaterFactory, LineUpdater, PathUpdater, PolylineUpdater, RectUpdater, TextUpdater, TextService, OffscreenCanvasCreator, DefaultSceneGraphService, DefaultSceneGraphSelector, SceneGraphSelector, SceneGraphSelectorFactory } from './services';
|
|
5
|
+
import { LayoutRegistry, CSSPropertyLocalPosition, CSSPropertyLengthOrPercentage, CSSPropertyAnchor, CSSPropertyClipPath, CSSPropertyColor, CSSPropertyFilter, CSSPropertyLineDash, CSSPropertyOffsetDistance, CSSPropertyOffsetPath, CSSPropertyOpacity, CSSPropertyPath, CSSPropertyPoints, CSSPropertyText, CSSPropertyTextTransform, CSSPropertyTransform, CSSPropertyTransformOrigin, CSSPropertyZIndex, CSSPropertyShadowBlur, DefaultStyleValueRegistry } from './css';
|
|
6
6
|
export var containerModule = Module(function (register) {
|
|
7
7
|
decorate(injectable(), EventEmitter); // bind DisplayObject pool
|
|
8
8
|
|
|
@@ -18,10 +18,7 @@ export var containerModule = Module(function (register) {
|
|
|
18
18
|
}
|
|
19
19
|
}); // bind scenegraph service
|
|
20
20
|
|
|
21
|
-
register(
|
|
22
|
-
token: SceneGraphService,
|
|
23
|
-
useClass: DefaultSceneGraphService
|
|
24
|
-
}); // bind text service
|
|
21
|
+
register(DefaultSceneGraphService); // bind text service
|
|
25
22
|
|
|
26
23
|
register(OffscreenCanvasCreator);
|
|
27
24
|
register(TextService); // bind aabb updater
|
|
@@ -50,7 +47,7 @@ export var containerModule = Module(function (register) {
|
|
|
50
47
|
}); // bind CSS property handlers
|
|
51
48
|
|
|
52
49
|
register(LayoutRegistry);
|
|
53
|
-
register(
|
|
50
|
+
register(DefaultStyleValueRegistry);
|
|
54
51
|
register(CSSPropertyLengthOrPercentage);
|
|
55
52
|
register(CSSPropertyLocalPosition);
|
|
56
53
|
register(CSSPropertyOpacity);
|
|
@@ -11,6 +11,7 @@ export interface CullingStrategyContribution {
|
|
|
11
11
|
* 2. other custom culling strategies, eg. frustum culling
|
|
12
12
|
*/
|
|
13
13
|
export declare class CullingPlugin implements RenderingPlugin {
|
|
14
|
+
static tag: string;
|
|
14
15
|
private strategyProvider;
|
|
15
16
|
apply(renderingService: RenderingService): void;
|
|
16
17
|
}
|
|
@@ -13,9 +13,11 @@ var CullingPlugin =
|
|
|
13
13
|
function () {
|
|
14
14
|
function CullingPlugin() {}
|
|
15
15
|
|
|
16
|
+
CullingPlugin_1 = CullingPlugin;
|
|
17
|
+
|
|
16
18
|
CullingPlugin.prototype.apply = function (renderingService) {
|
|
17
19
|
var strategies = this.strategyProvider.getContributions();
|
|
18
|
-
renderingService.hooks.cull.tap(function (object) {
|
|
20
|
+
renderingService.hooks.cull.tap(CullingPlugin_1.tag, function (object) {
|
|
19
21
|
if (object) {
|
|
20
22
|
var cullable = object.cullable;
|
|
21
23
|
|
|
@@ -37,14 +39,17 @@ function () {
|
|
|
37
39
|
|
|
38
40
|
return object;
|
|
39
41
|
});
|
|
40
|
-
renderingService.hooks.afterRender.tap(function (object) {
|
|
42
|
+
renderingService.hooks.afterRender.tap(CullingPlugin_1.tag, function (object) {
|
|
41
43
|
object.cullable.visibilityPlaneMask = -1;
|
|
42
44
|
});
|
|
43
45
|
};
|
|
44
46
|
|
|
47
|
+
var CullingPlugin_1;
|
|
48
|
+
CullingPlugin.tag = 'Culling';
|
|
49
|
+
|
|
45
50
|
__decorate([contrib(CullingStrategyContribution), __metadata("design:type", Object)], CullingPlugin.prototype, "strategyProvider", void 0);
|
|
46
51
|
|
|
47
|
-
CullingPlugin = __decorate([singleton({
|
|
52
|
+
CullingPlugin = CullingPlugin_1 = __decorate([singleton({
|
|
48
53
|
contrib: RenderingPluginContribution
|
|
49
54
|
})], CullingPlugin);
|
|
50
55
|
return CullingPlugin;
|
|
@@ -3,6 +3,7 @@ import type { RenderingService, RenderingPlugin } from '../services/RenderingSer
|
|
|
3
3
|
* Filter dirty renderables and calculate the "dirty rectangle" which will be clear when frame began
|
|
4
4
|
*/
|
|
5
5
|
export declare class DirtyCheckPlugin implements RenderingPlugin {
|
|
6
|
+
static tag: string;
|
|
6
7
|
private canvasConfig;
|
|
7
8
|
private renderingContext;
|
|
8
9
|
apply(renderingService: RenderingService): void;
|
|
@@ -12,10 +12,12 @@ var DirtyCheckPlugin =
|
|
|
12
12
|
function () {
|
|
13
13
|
function DirtyCheckPlugin() {}
|
|
14
14
|
|
|
15
|
+
DirtyCheckPlugin_1 = DirtyCheckPlugin;
|
|
16
|
+
|
|
15
17
|
DirtyCheckPlugin.prototype.apply = function (renderingService) {
|
|
16
18
|
var _this = this;
|
|
17
19
|
|
|
18
|
-
renderingService.hooks.dirtycheck.tap(function (object) {
|
|
20
|
+
renderingService.hooks.dirtycheck.tap(DirtyCheckPlugin_1.tag, function (object) {
|
|
19
21
|
if (object) {
|
|
20
22
|
var enableDirtyCheck = _this.canvasConfig.renderer.getConfig().enableDirtyCheck;
|
|
21
23
|
|
|
@@ -37,11 +39,14 @@ function () {
|
|
|
37
39
|
});
|
|
38
40
|
};
|
|
39
41
|
|
|
42
|
+
var DirtyCheckPlugin_1;
|
|
43
|
+
DirtyCheckPlugin.tag = 'DirtyCheck';
|
|
44
|
+
|
|
40
45
|
__decorate([inject(CanvasConfig), __metadata("design:type", Object)], DirtyCheckPlugin.prototype, "canvasConfig", void 0);
|
|
41
46
|
|
|
42
47
|
__decorate([inject(RenderingContext), __metadata("design:type", Object)], DirtyCheckPlugin.prototype, "renderingContext", void 0);
|
|
43
48
|
|
|
44
|
-
DirtyCheckPlugin = __decorate([singleton({
|
|
49
|
+
DirtyCheckPlugin = DirtyCheckPlugin_1 = __decorate([singleton({
|
|
45
50
|
contrib: RenderingPluginContribution
|
|
46
51
|
})], DirtyCheckPlugin);
|
|
47
52
|
return DirtyCheckPlugin;
|
|
@@ -7,6 +7,7 @@ import { RenderingService } from '../services';
|
|
|
7
7
|
* also provide some extra events such as `drag`
|
|
8
8
|
*/
|
|
9
9
|
export declare class EventPlugin implements RenderingPlugin {
|
|
10
|
+
static tag: string;
|
|
10
11
|
private canvasConfig;
|
|
11
12
|
private contextService;
|
|
12
13
|
private renderingService;
|
|
@@ -41,6 +41,8 @@ function () {
|
|
|
41
41
|
};
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
+
EventPlugin_1 = EventPlugin;
|
|
45
|
+
|
|
44
46
|
EventPlugin.prototype.apply = function (renderingService) {
|
|
45
47
|
var _this = this;
|
|
46
48
|
|
|
@@ -53,7 +55,7 @@ function () {
|
|
|
53
55
|
case 0:
|
|
54
56
|
return [4
|
|
55
57
|
/*yield*/
|
|
56
|
-
, this.renderingService.hooks.pick.
|
|
58
|
+
, this.renderingService.hooks.pick.promise({
|
|
57
59
|
position: position,
|
|
58
60
|
picked: [],
|
|
59
61
|
topmost: true // we only concern the topmost element
|
|
@@ -69,12 +71,12 @@ function () {
|
|
|
69
71
|
});
|
|
70
72
|
});
|
|
71
73
|
});
|
|
72
|
-
renderingService.hooks.pointerWheel.tap(function (nativeEvent) {
|
|
74
|
+
renderingService.hooks.pointerWheel.tap(EventPlugin_1.tag, function (nativeEvent) {
|
|
73
75
|
var wheelEvent = _this.normalizeWheelEvent(nativeEvent);
|
|
74
76
|
|
|
75
77
|
_this.eventService.mapEvent(wheelEvent);
|
|
76
78
|
});
|
|
77
|
-
renderingService.hooks.pointerDown.tap(function (nativeEvent) {
|
|
79
|
+
renderingService.hooks.pointerDown.tap(EventPlugin_1.tag, function (nativeEvent) {
|
|
78
80
|
if (canvas.supportTouchEvent && nativeEvent.pointerType === 'touch') {
|
|
79
81
|
return;
|
|
80
82
|
}
|
|
@@ -95,7 +97,7 @@ function () {
|
|
|
95
97
|
|
|
96
98
|
_this.setCursor(_this.eventService.cursor);
|
|
97
99
|
});
|
|
98
|
-
renderingService.hooks.pointerUp.tap(function (nativeEvent) {
|
|
100
|
+
renderingService.hooks.pointerUp.tap(EventPlugin_1.tag, function (nativeEvent) {
|
|
99
101
|
if (canvas.supportTouchEvent && nativeEvent.pointerType === 'touch') return; // account for element in SVG
|
|
100
102
|
|
|
101
103
|
var $element = _this.contextService.getDomElement();
|
|
@@ -114,10 +116,10 @@ function () {
|
|
|
114
116
|
|
|
115
117
|
_this.setCursor(_this.eventService.cursor);
|
|
116
118
|
});
|
|
117
|
-
renderingService.hooks.pointerMove.tap(this.onPointerMove);
|
|
118
|
-
renderingService.hooks.pointerOver.tap(this.onPointerMove);
|
|
119
|
-
renderingService.hooks.pointerOut.tap(this.onPointerMove);
|
|
120
|
-
renderingService.hooks.pointerCancel.tap(function (nativeEvent) {
|
|
119
|
+
renderingService.hooks.pointerMove.tap(EventPlugin_1.tag, this.onPointerMove);
|
|
120
|
+
renderingService.hooks.pointerOver.tap(EventPlugin_1.tag, this.onPointerMove);
|
|
121
|
+
renderingService.hooks.pointerOut.tap(EventPlugin_1.tag, this.onPointerMove);
|
|
122
|
+
renderingService.hooks.pointerCancel.tap(EventPlugin_1.tag, function (nativeEvent) {
|
|
121
123
|
if (canvas.supportTouchEvent && nativeEvent.pointerType === 'touch') {
|
|
122
124
|
return;
|
|
123
125
|
}
|
|
@@ -350,6 +352,9 @@ function () {
|
|
|
350
352
|
}
|
|
351
353
|
};
|
|
352
354
|
|
|
355
|
+
var EventPlugin_1;
|
|
356
|
+
EventPlugin.tag = 'Event';
|
|
357
|
+
|
|
353
358
|
__decorate([inject(CanvasConfig), __metadata("design:type", Object)], EventPlugin.prototype, "canvasConfig", void 0);
|
|
354
359
|
|
|
355
360
|
__decorate([inject(ContextService), __metadata("design:type", Object)], EventPlugin.prototype, "contextService", void 0);
|
|
@@ -360,7 +365,7 @@ function () {
|
|
|
360
365
|
|
|
361
366
|
__decorate([inject(EventService), __metadata("design:type", EventService)], EventPlugin.prototype, "eventService", void 0);
|
|
362
367
|
|
|
363
|
-
EventPlugin = __decorate([singleton({
|
|
368
|
+
EventPlugin = EventPlugin_1 = __decorate([singleton({
|
|
364
369
|
contrib: RenderingPluginContribution
|
|
365
370
|
})], EventPlugin);
|
|
366
371
|
return EventPlugin;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { RenderingService, RenderingPlugin } from '../services';
|
|
2
2
|
export declare class PrepareRendererPlugin implements RenderingPlugin {
|
|
3
|
+
static tag: string;
|
|
3
4
|
private renderingContext;
|
|
4
5
|
private styleValueRegistry;
|
|
5
6
|
apply(renderingService: RenderingService): void;
|