@antv/g 5.0.22-alpha.5 → 5.0.23-alpha.0
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 +30 -0
- package/es/AbstractRenderer.js +8 -1
- package/es/Canvas.d.ts +1 -1
- package/es/Canvas.js +5 -3
- package/es/DisplayObjectPool.js +3 -1
- package/es/camera/Camera.d.ts +105 -66
- package/es/camera/Camera.js +306 -170
- package/es/camera/Landmark.d.ts +18 -25
- package/es/camera/Landmark.js +1 -72
- package/es/canvas-module.js +2 -4
- package/es/components/Cullable.js +3 -1
- package/es/components/Geometry.js +3 -1
- package/es/components/Renderable.js +3 -1
- package/es/components/Sortable.js +3 -1
- package/es/components/Transform.js +3 -1
- package/es/css/LayoutRegistry.js +3 -1
- package/es/css/StyleValueRegistry.d.ts +8 -0
- package/es/css/StyleValueRegistry.js +24 -19
- package/es/css/cssom/CSSColorValue.js +3 -1
- package/es/css/cssom/CSSGradientValue.js +8 -6
- package/es/css/cssom/CSSKeywordValue.js +3 -1
- package/es/css/cssom/CSSMathInvert.js +3 -1
- package/es/css/cssom/CSSMathMax.js +3 -1
- package/es/css/cssom/CSSMathMin.js +3 -1
- package/es/css/cssom/CSSMathNegate.js +3 -1
- package/es/css/cssom/CSSMathProduct.js +3 -1
- package/es/css/cssom/CSSMathSum.js +3 -1
- package/es/css/cssom/CSSMathValue.js +3 -1
- package/es/css/cssom/CSSMathVariadic.js +3 -1
- package/es/css/cssom/CSSNumericValue.js +3 -1
- package/es/css/cssom/CSSNumericValueType.d.ts +1 -1
- package/es/css/cssom/CSSNumericValueType.js +3 -1
- package/es/css/cssom/CSSRGB.js +4 -2
- package/es/css/cssom/CSSStyleValue.d.ts +1 -1
- package/es/css/cssom/CSSStyleValue.js +3 -1
- package/es/css/cssom/CSSTransformComponent.js +3 -1
- package/es/css/cssom/CSSTransformValue.js +3 -1
- package/es/css/cssom/CSSTranslate.js +3 -1
- package/es/css/cssom/CSSUnitValue.js +4 -2
- package/es/css/parser/color.js +2 -2
- package/es/css/parser/dimension.d.ts +1 -1
- package/es/css/parser/dimension.js +2 -3
- package/es/css/parser/numeric.js +1 -1
- package/es/css/parser/path.d.ts +2 -2
- package/es/css/parser/path.js +1 -1
- package/es/css/parser/points.js +1 -1
- package/es/css/parser/transform-origin.js +1 -1
- package/es/css/properties/CSSPropertyAnchor.js +3 -1
- package/es/css/properties/CSSPropertyClipPath.js +3 -1
- package/es/css/properties/CSSPropertyColor.js +3 -1
- package/es/css/properties/CSSPropertyFilter.js +3 -1
- package/es/css/properties/CSSPropertyLengthOrPercentage.js +3 -1
- package/es/css/properties/CSSPropertyLineDash.js +3 -1
- package/es/css/properties/CSSPropertyLocalPosition.js +3 -1
- package/es/css/properties/CSSPropertyOffsetDistance.js +3 -1
- package/es/css/properties/CSSPropertyOffsetPath.js +3 -1
- package/es/css/properties/CSSPropertyOpacity.js +3 -1
- package/es/css/properties/CSSPropertyPath.d.ts +14 -2
- package/es/css/properties/CSSPropertyPath.js +3 -1
- package/es/css/properties/CSSPropertyPoints.js +3 -1
- package/es/css/properties/CSSPropertyShadowBlur.js +3 -1
- package/es/css/properties/CSSPropertyText.d.ts +1 -1
- package/es/css/properties/CSSPropertyText.js +4 -2
- package/es/css/properties/CSSPropertyTextTransform.d.ts +3 -3
- package/es/css/properties/CSSPropertyTextTransform.js +3 -1
- package/es/css/properties/CSSPropertyTransform.js +4 -3
- package/es/css/properties/CSSPropertyTransformOrigin.js +3 -1
- package/es/css/properties/CSSPropertyVisibility.js +3 -1
- package/es/css/properties/CSSPropertyZIndex.js +3 -1
- package/es/display-objects/Circle.js +3 -1
- package/es/display-objects/CustomElement.js +3 -1
- package/es/display-objects/DisplayObject.js +10 -8
- package/es/display-objects/Ellipse.js +3 -1
- package/es/display-objects/Group.js +3 -1
- package/es/display-objects/HTML.js +6 -3
- package/es/display-objects/Image.js +3 -1
- package/es/display-objects/Line.js +3 -1
- package/es/display-objects/Path.d.ts +15 -15
- package/es/display-objects/Path.js +5 -3
- package/es/display-objects/Polygon.d.ts +8 -1
- package/es/display-objects/Polygon.js +3 -1
- package/es/display-objects/Polyline.d.ts +7 -5
- package/es/display-objects/Polyline.js +3 -1
- package/es/display-objects/Rect.js +3 -1
- package/es/display-objects/Text.js +6 -3
- package/es/dom/Animation.js +4 -2
- package/es/dom/AnimationEffectTiming.js +3 -1
- package/es/dom/AnimationEvent.js +3 -1
- package/es/dom/AnimationTimeline.js +3 -1
- package/es/dom/CustomElementRegistry.js +3 -1
- package/es/dom/CustomEvent.js +3 -1
- package/es/dom/Document.js +5 -3
- package/es/dom/Element.js +7 -6
- package/es/dom/EventTarget.js +6 -4
- package/es/dom/FederatedEvent.js +3 -1
- package/es/dom/FederatedMouseEvent.js +3 -1
- package/es/dom/FederatedPointerEvent.js +3 -1
- package/es/dom/FederatedTouchEvent.d.ts +15 -0
- package/es/dom/FederatedTouchEvent.js +19 -0
- package/es/dom/FederatedWheelEvent.js +3 -1
- package/es/dom/KeyframeEffect.js +3 -1
- package/es/dom/KeyframeList.js +1 -1
- package/es/dom/MutationEvent.js +3 -1
- package/es/dom/MutationObserver.js +10 -3
- package/es/dom/MutationRecord.js +3 -1
- package/es/dom/Node.js +4 -2
- package/es/plugins/CullingPlugin.d.ts +0 -1
- package/es/plugins/CullingPlugin.js +6 -9
- package/es/plugins/DirtyCheckPlugin.d.ts +1 -1
- package/es/plugins/DirtyCheckPlugin.js +12 -9
- package/es/plugins/EventPlugin.d.ts +1 -1
- package/es/plugins/EventPlugin.js +166 -149
- package/es/plugins/FrustumCullingStrategy.js +3 -1
- package/es/plugins/PrepareRendererPlugin.d.ts +0 -1
- package/es/plugins/PrepareRendererPlugin.js +18 -17
- package/es/services/EventService.d.ts +8 -0
- package/es/services/EventService.js +279 -23
- package/es/services/OffscreenCanvasCreator.js +3 -1
- package/es/services/RenderingService.d.ts +17 -16
- package/es/services/RenderingService.js +21 -18
- package/es/services/SceneGraphSelector.js +3 -1
- package/es/services/SceneGraphService.js +4 -2
- package/es/services/TextService.js +5 -3
- package/es/services/aabb/CircleUpdater.js +3 -1
- package/es/services/aabb/EllipseUpdater.js +3 -1
- package/es/services/aabb/LineUpdater.js +3 -1
- package/es/services/aabb/PathUpdater.d.ts +3 -3
- package/es/services/aabb/PathUpdater.js +3 -1
- package/es/services/aabb/PolylineUpdater.d.ts +3 -3
- package/es/services/aabb/PolylineUpdater.js +3 -1
- package/es/services/aabb/RectUpdater.js +4 -2
- package/es/services/aabb/TextUpdater.js +3 -1
- package/es/shapes/AABB.js +3 -1
- package/es/shapes/BoundingSphere.js +3 -1
- package/es/shapes/Frustum.js +3 -1
- package/es/shapes/Plane.js +3 -1
- package/es/shapes/Point.js +3 -1
- package/es/shapes/Ray.js +3 -1
- package/es/shapes/Rectangle.js +3 -1
- package/es/types.d.ts +9 -3
- package/es/utils/assert.d.ts +6 -0
- package/es/utils/assert.js +18 -0
- package/es/utils/custom-easing.js +1 -1
- package/es/utils/event.d.ts +18 -16
- package/es/utils/hooks.d.ts +280 -0
- package/es/utils/hooks.js +753 -0
- package/es/utils/index.d.ts +1 -0
- package/es/utils/index.js +2 -1
- package/es/utils/math.d.ts +2 -2
- package/es/utils/math.js +22 -6
- package/es/utils/path.d.ts +1 -1
- package/es/utils/path.js +3 -3
- package/es/utils/string.d.ts +1 -0
- package/es/utils/string.js +8 -0
- package/es/utils/text.js +5 -4
- package/lib/AbstractRenderer.js +8 -1
- package/lib/Canvas.d.ts +1 -1
- package/lib/Canvas.js +5 -3
- package/lib/DisplayObjectPool.js +3 -1
- package/lib/camera/Camera.d.ts +105 -66
- package/lib/camera/Camera.js +313 -178
- package/lib/camera/Landmark.d.ts +18 -25
- package/lib/camera/Landmark.js +1 -75
- package/lib/canvas-module.js +1 -3
- package/lib/components/Cullable.js +4 -2
- package/lib/components/Geometry.js +3 -1
- package/lib/components/Renderable.js +3 -1
- package/lib/components/Sortable.js +3 -1
- package/lib/components/Transform.js +3 -1
- package/lib/css/LayoutRegistry.js +3 -1
- package/lib/css/StyleValueRegistry.d.ts +8 -0
- package/lib/css/StyleValueRegistry.js +27 -20
- package/lib/css/cssom/CSSColorValue.js +3 -1
- package/lib/css/cssom/CSSGradientValue.js +9 -7
- package/lib/css/cssom/CSSKeywordValue.js +3 -1
- package/lib/css/cssom/CSSMathInvert.js +3 -1
- package/lib/css/cssom/CSSMathMax.js +3 -1
- package/lib/css/cssom/CSSMathMin.js +3 -1
- package/lib/css/cssom/CSSMathNegate.js +3 -1
- package/lib/css/cssom/CSSMathOperator.js +1 -1
- package/lib/css/cssom/CSSMathProduct.js +3 -1
- package/lib/css/cssom/CSSMathSum.js +3 -1
- package/lib/css/cssom/CSSMathValue.js +3 -1
- package/lib/css/cssom/CSSMathVariadic.js +4 -2
- package/lib/css/cssom/CSSNumericValue.js +3 -1
- package/lib/css/cssom/CSSNumericValueType.d.ts +1 -1
- package/lib/css/cssom/CSSNumericValueType.js +5 -3
- package/lib/css/cssom/CSSRGB.js +4 -2
- package/lib/css/cssom/CSSStyleValue.d.ts +1 -1
- package/lib/css/cssom/CSSStyleValue.js +4 -2
- package/lib/css/cssom/CSSTransformComponent.js +4 -2
- package/lib/css/cssom/CSSTransformValue.js +3 -1
- package/lib/css/cssom/CSSTranslate.js +3 -1
- package/lib/css/cssom/CSSUnitValue.js +4 -2
- package/lib/css/cssom/types.js +1 -1
- package/lib/css/parser/color.js +8 -8
- package/lib/css/parser/dimension.d.ts +1 -1
- package/lib/css/parser/dimension.js +8 -9
- package/lib/css/parser/numeric.js +6 -6
- package/lib/css/parser/path.d.ts +2 -2
- package/lib/css/parser/path.js +5 -5
- package/lib/css/parser/points.js +2 -2
- package/lib/css/parser/transform-origin.js +2 -2
- package/lib/css/parser/transform.js +2 -2
- package/lib/css/properties/CSSPropertyAnchor.js +3 -1
- package/lib/css/properties/CSSPropertyClipPath.js +3 -1
- package/lib/css/properties/CSSPropertyColor.js +3 -1
- package/lib/css/properties/CSSPropertyFilter.js +3 -1
- package/lib/css/properties/CSSPropertyLengthOrPercentage.js +3 -1
- package/lib/css/properties/CSSPropertyLineDash.js +3 -1
- package/lib/css/properties/CSSPropertyLocalPosition.js +3 -1
- package/lib/css/properties/CSSPropertyOffsetDistance.js +3 -1
- package/lib/css/properties/CSSPropertyOffsetPath.js +3 -1
- package/lib/css/properties/CSSPropertyOpacity.js +3 -1
- package/lib/css/properties/CSSPropertyPath.d.ts +14 -2
- package/lib/css/properties/CSSPropertyPath.js +3 -1
- package/lib/css/properties/CSSPropertyPoints.js +3 -1
- package/lib/css/properties/CSSPropertyShadowBlur.js +3 -1
- package/lib/css/properties/CSSPropertyText.d.ts +1 -1
- package/lib/css/properties/CSSPropertyText.js +4 -2
- package/lib/css/properties/CSSPropertyTextTransform.d.ts +3 -3
- package/lib/css/properties/CSSPropertyTextTransform.js +3 -1
- package/lib/css/properties/CSSPropertyTransform.js +3 -3
- package/lib/css/properties/CSSPropertyTransformOrigin.js +3 -1
- package/lib/css/properties/CSSPropertyVisibility.js +3 -1
- package/lib/css/properties/CSSPropertyZIndex.js +3 -1
- package/lib/display-objects/Circle.js +3 -1
- package/lib/display-objects/CustomElement.js +3 -1
- package/lib/display-objects/DisplayObject.js +13 -12
- package/lib/display-objects/Ellipse.js +3 -1
- package/lib/display-objects/Group.js +3 -1
- package/lib/display-objects/HTML.js +6 -4
- package/lib/display-objects/Image.js +3 -1
- package/lib/display-objects/Line.js +3 -1
- package/lib/display-objects/Path.d.ts +15 -15
- package/lib/display-objects/Path.js +7 -5
- package/lib/display-objects/Polygon.d.ts +8 -1
- package/lib/display-objects/Polygon.js +3 -1
- package/lib/display-objects/Polyline.d.ts +7 -5
- package/lib/display-objects/Polyline.js +3 -1
- package/lib/display-objects/Rect.js +3 -1
- package/lib/display-objects/Text.js +6 -4
- package/lib/dom/Animation.js +4 -2
- package/lib/dom/AnimationEffectTiming.js +3 -1
- package/lib/dom/AnimationEvent.js +3 -1
- package/lib/dom/AnimationTimeline.js +4 -2
- package/lib/dom/CustomElementRegistry.js +3 -1
- package/lib/dom/CustomEvent.js +3 -1
- package/lib/dom/Document.js +5 -3
- package/lib/dom/Element.js +7 -7
- package/lib/dom/EventTarget.js +14 -12
- package/lib/dom/FederatedEvent.js +3 -1
- package/lib/dom/FederatedMouseEvent.js +3 -1
- package/lib/dom/FederatedPointerEvent.js +3 -1
- package/lib/dom/FederatedTouchEvent.d.ts +15 -0
- package/lib/dom/FederatedTouchEvent.js +27 -0
- package/lib/dom/FederatedWheelEvent.js +3 -1
- package/lib/dom/KeyframeEffect.js +4 -2
- package/lib/dom/KeyframeList.js +1 -1
- package/lib/dom/MutationEvent.js +3 -1
- package/lib/dom/MutationObserver.js +11 -4
- package/lib/dom/MutationRecord.js +3 -1
- package/lib/dom/Node.js +4 -2
- package/lib/index.js +1 -1
- package/lib/plugins/CullingPlugin.d.ts +0 -1
- package/lib/plugins/CullingPlugin.js +7 -9
- package/lib/plugins/DirtyCheckPlugin.d.ts +1 -1
- package/lib/plugins/DirtyCheckPlugin.js +13 -9
- package/lib/plugins/EventPlugin.d.ts +1 -1
- package/lib/plugins/EventPlugin.js +175 -157
- package/lib/plugins/FrustumCullingStrategy.js +3 -1
- package/lib/plugins/PrepareRendererPlugin.d.ts +0 -1
- package/lib/plugins/PrepareRendererPlugin.js +17 -15
- package/lib/services/EventService.d.ts +8 -0
- package/lib/services/EventService.js +279 -22
- package/lib/services/OffscreenCanvasCreator.js +3 -1
- package/lib/services/RenderingService.d.ts +17 -16
- package/lib/services/RenderingService.js +22 -19
- package/lib/services/SceneGraphSelector.js +4 -2
- package/lib/services/SceneGraphService.js +8 -6
- package/lib/services/TextService.js +5 -3
- package/lib/services/aabb/CircleUpdater.js +3 -1
- package/lib/services/aabb/EllipseUpdater.js +3 -1
- package/lib/services/aabb/LineUpdater.js +3 -1
- package/lib/services/aabb/PathUpdater.d.ts +3 -3
- package/lib/services/aabb/PathUpdater.js +3 -1
- package/lib/services/aabb/PolylineUpdater.d.ts +3 -3
- package/lib/services/aabb/PolylineUpdater.js +3 -1
- package/lib/services/aabb/RectUpdater.js +6 -4
- package/lib/services/aabb/TextUpdater.js +3 -1
- package/lib/services/aabb/index.js +10 -10
- package/lib/services/aabb/interfaces.js +1 -1
- package/lib/shapes/AABB.js +3 -1
- package/lib/shapes/BoundingSphere.js +3 -1
- package/lib/shapes/Frustum.js +4 -2
- package/lib/shapes/Plane.js +3 -1
- package/lib/shapes/Point.js +3 -1
- package/lib/shapes/Ray.js +3 -1
- package/lib/shapes/Rectangle.js +3 -1
- package/lib/types.d.ts +9 -3
- package/lib/types.js +1 -1
- package/lib/utils/animation.js +3 -2
- package/lib/utils/assert.d.ts +6 -0
- package/lib/utils/assert.js +30 -0
- package/lib/utils/bezier-easing.js +1 -1
- package/lib/utils/custom-easing.js +2 -2
- package/lib/utils/event.d.ts +18 -16
- package/lib/utils/hooks.d.ts +280 -0
- package/lib/utils/hooks.js +759 -0
- package/lib/utils/index.d.ts +1 -0
- package/lib/utils/index.js +13 -0
- package/lib/utils/math.d.ts +2 -2
- package/lib/utils/math.js +34 -18
- package/lib/utils/path.d.ts +1 -1
- package/lib/utils/path.js +6 -6
- package/lib/utils/string.d.ts +1 -0
- package/lib/utils/string.js +11 -0
- package/lib/utils/text.js +7 -5
- package/package.json +5 -6
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { GeometryAABBUpdater } from './interfaces';
|
|
2
|
-
import type {
|
|
3
|
-
export declare class PolylineUpdater implements GeometryAABBUpdater<
|
|
4
|
-
update(parsedStyle:
|
|
2
|
+
import type { ParsedPolylineStyleProps } from '../../display-objects';
|
|
3
|
+
export declare class PolylineUpdater implements GeometryAABBUpdater<ParsedPolylineStyleProps> {
|
|
4
|
+
update(parsedStyle: ParsedPolylineStyleProps): {
|
|
5
5
|
width: number;
|
|
6
6
|
height: number;
|
|
7
7
|
x: number;
|
|
@@ -3,7 +3,9 @@ import { singleton } from 'mana-syringe';
|
|
|
3
3
|
import { GeometryAABBUpdater } from './interfaces';
|
|
4
4
|
import { Shape } from '../../types';
|
|
5
5
|
|
|
6
|
-
var PolylineUpdater =
|
|
6
|
+
var PolylineUpdater =
|
|
7
|
+
/** @class */
|
|
8
|
+
function () {
|
|
7
9
|
function PolylineUpdater() {}
|
|
8
10
|
|
|
9
11
|
PolylineUpdater.prototype.update = function (parsedStyle) {
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { __decorate } from "tslib";
|
|
2
2
|
import { singleton } from 'mana-syringe';
|
|
3
|
-
import { isString } from '@antv/util';
|
|
4
3
|
import { GeometryAABBUpdater } from './interfaces';
|
|
5
4
|
import { Shape } from '../../types';
|
|
6
5
|
import { CSSUnitValue, UnitType } from '../../css';
|
|
6
|
+
import { isString } from '../../utils';
|
|
7
7
|
|
|
8
|
-
var RectUpdater =
|
|
8
|
+
var RectUpdater =
|
|
9
|
+
/** @class */
|
|
10
|
+
function () {
|
|
9
11
|
function RectUpdater() {}
|
|
10
12
|
|
|
11
13
|
RectUpdater.prototype.update = function (parsedStyle, object) {
|
|
@@ -6,7 +6,9 @@ import { TextService } from '../TextService';
|
|
|
6
6
|
import { Shape } from '../../types';
|
|
7
7
|
import { CSSUnitValue } from '../../css';
|
|
8
8
|
|
|
9
|
-
var TextUpdater =
|
|
9
|
+
var TextUpdater =
|
|
10
|
+
/** @class */
|
|
11
|
+
function () {
|
|
10
12
|
function TextUpdater() {}
|
|
11
13
|
|
|
12
14
|
TextUpdater.prototype.isReadyToMeasure = function (parsedStyle, object) {
|
package/es/shapes/AABB.js
CHANGED
|
@@ -5,7 +5,9 @@ import { vec3 } from 'gl-matrix';
|
|
|
5
5
|
* @see https://github.com/antvis/GWebGPUEngine/issues/3
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
var AABB =
|
|
8
|
+
var AABB =
|
|
9
|
+
/** @class */
|
|
10
|
+
function () {
|
|
9
11
|
function AABB(center, halfExtents) {
|
|
10
12
|
this.min = vec3.create();
|
|
11
13
|
this.max = vec3.create();
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { vec3 } from 'gl-matrix';
|
|
2
2
|
var tmpVecA = vec3.create();
|
|
3
3
|
|
|
4
|
-
var BoundingSphere =
|
|
4
|
+
var BoundingSphere =
|
|
5
|
+
/** @class */
|
|
6
|
+
function () {
|
|
5
7
|
function BoundingSphere(center, radius) {
|
|
6
8
|
this.center = center || vec3.create();
|
|
7
9
|
this.radius = radius || 0.5;
|
package/es/shapes/Frustum.js
CHANGED
package/es/shapes/Plane.js
CHANGED
package/es/shapes/Point.js
CHANGED
package/es/shapes/Ray.js
CHANGED
|
@@ -11,7 +11,9 @@ var tmpVecE = vec3.create();
|
|
|
11
11
|
* @see https://github.com/mrdoob/three.js/blob/dev/src/math/Ray.js
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
|
-
var Ray =
|
|
14
|
+
var Ray =
|
|
15
|
+
/** @class */
|
|
16
|
+
function () {
|
|
15
17
|
function Ray(origin, direction) {
|
|
16
18
|
this.origin = origin || vec3.create();
|
|
17
19
|
this.direction = direction || vec3.fromValues(0, 0, -1);
|
package/es/shapes/Rectangle.js
CHANGED
package/es/types.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="offscreencanvas" />
|
|
2
2
|
import type { vec2, vec3 } from 'gl-matrix';
|
|
3
|
-
import type { DisplayObject
|
|
3
|
+
import type { DisplayObject } from './display-objects';
|
|
4
4
|
import type { IRenderer } from './AbstractRenderer';
|
|
5
5
|
import type { CSSGlobalKeywords, CSSGradientValue, CSSKeywordValue, CSSRGB, CSSUnitValue } from './css';
|
|
6
6
|
import { Syringe } from 'mana-syringe';
|
|
@@ -120,6 +120,10 @@ export interface BaseStyleProps {
|
|
|
120
120
|
opacity?: number;
|
|
121
121
|
/** 线宽 */
|
|
122
122
|
lineWidth?: string | number;
|
|
123
|
+
/**
|
|
124
|
+
* 交互区域
|
|
125
|
+
*/
|
|
126
|
+
hitArea?: DisplayObject | null;
|
|
123
127
|
/** 指定如何绘制每一条线段末端 */
|
|
124
128
|
lineCap?: CanvasLineCap;
|
|
125
129
|
/** 用来设置2个长度不为0的相连部分(线段,圆弧,曲线)如何连接在一起的属性(长度为0的变形部分,其指定的末端和控制点在同一位置,会被忽略) */
|
|
@@ -167,8 +171,6 @@ export interface ParsedBaseStyleProps extends Omit<BaseStyleProps, 'anchor' | 'x
|
|
|
167
171
|
lineCap?: CSSKeywordValue;
|
|
168
172
|
lineJoin?: CSSKeywordValue;
|
|
169
173
|
lineDashOffset?: CSSUnitValue;
|
|
170
|
-
path?: ParsedPathStyleProps;
|
|
171
|
-
points?: ParsedPolylineStyleProps;
|
|
172
174
|
anchor?: [CSSUnitValue, CSSUnitValue, CSSUnitValue];
|
|
173
175
|
transformOrigin?: [CSSUnitValue, CSSUnitValue, CSSUnitValue];
|
|
174
176
|
x?: CSSUnitValue;
|
|
@@ -195,6 +197,10 @@ export interface ParsedBaseStyleProps extends Omit<BaseStyleProps, 'anchor' | 'x
|
|
|
195
197
|
}
|
|
196
198
|
export declare type Cursor = 'auto' | 'default' | 'none' | 'context-menu' | 'help' | 'pointer' | 'progress' | 'wait' | 'cell' | 'crosshair' | 'text' | 'vertical-text' | 'alias' | 'copy' | 'move' | 'no-drop' | 'not-allowed' | 'grab' | 'grabbing' | 'all-scroll' | 'col-resize' | 'row-resize' | 'n-resize' | 'e-resize' | 's-resize' | 'w-resize' | 'ne-resize' | 'nw-resize' | 'se-resize' | 'sw-resize' | 'ew-resize' | 'ns-resize' | 'nesw-resize' | 'nwse-resize' | 'zoom-in' | 'zoom-out';
|
|
197
199
|
export interface RendererConfig {
|
|
200
|
+
/**
|
|
201
|
+
* enable dirty check for displayobject
|
|
202
|
+
*/
|
|
203
|
+
enableDirtyCheck: boolean;
|
|
198
204
|
/**
|
|
199
205
|
* enable dirty rectangle rendering
|
|
200
206
|
*/
|
package/es/utils/assert.d.ts
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
1
|
export declare function DCHECK(bool: boolean): void;
|
|
2
2
|
export declare function DCHECK_EQ(a: any, b: any): void;
|
|
3
3
|
export declare function DCHECK_NE(a: any, b: any): void;
|
|
4
|
+
export declare function isUndefined(a: any): boolean;
|
|
5
|
+
export declare function isNil(a: any): boolean;
|
|
6
|
+
export declare function isNumber(value: any): value is number;
|
|
7
|
+
export declare function isFunction(value: any): value is Function;
|
|
8
|
+
export declare function isBoolean(value: any): value is boolean;
|
|
9
|
+
export declare function isObject(value: any): value is object;
|
package/es/utils/assert.js
CHANGED
|
@@ -12,4 +12,22 @@ export function DCHECK_NE(a, b) {
|
|
|
12
12
|
if (a === b) {
|
|
13
13
|
throw new Error();
|
|
14
14
|
}
|
|
15
|
+
}
|
|
16
|
+
export function isUndefined(a) {
|
|
17
|
+
return typeof a === 'undefined';
|
|
18
|
+
}
|
|
19
|
+
export function isNil(a) {
|
|
20
|
+
return a == null;
|
|
21
|
+
}
|
|
22
|
+
export function isNumber(value) {
|
|
23
|
+
return typeof value === 'number';
|
|
24
|
+
}
|
|
25
|
+
export function isFunction(value) {
|
|
26
|
+
return typeof value === 'function';
|
|
27
|
+
}
|
|
28
|
+
export function isBoolean(value) {
|
|
29
|
+
return typeof value === 'boolean';
|
|
30
|
+
}
|
|
31
|
+
export function isObject(value) {
|
|
32
|
+
return Object.prototype.toString.call(value) === '[object Object]';
|
|
15
33
|
}
|
|
@@ -6,7 +6,7 @@ import { __read } from "tslib";
|
|
|
6
6
|
import { bezier } from './bezier-easing';
|
|
7
7
|
export var convertToDash = function convertToDash(str) {
|
|
8
8
|
str = str.replace(/([A-Z])/g, function (letter) {
|
|
9
|
-
return "-"
|
|
9
|
+
return "-".concat(letter.toLowerCase());
|
|
10
10
|
}); // Remove first dash
|
|
11
11
|
|
|
12
12
|
return str.charAt(0) === '-' ? str.substr(1) : str;
|
package/es/utils/event.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { IEventTarget } from '../dom';
|
|
1
2
|
export declare const MOUSE_POINTER_ID = 1;
|
|
2
3
|
export declare const TOUCH_TO_POINTER: Record<string, string>;
|
|
3
4
|
export interface FormattedPointerEvent extends PointerEvent {
|
|
@@ -14,25 +15,12 @@ export interface FormattedPointerEvent extends PointerEvent {
|
|
|
14
15
|
isNormalized: boolean;
|
|
15
16
|
type: string;
|
|
16
17
|
}
|
|
17
|
-
export interface
|
|
18
|
-
button: number;
|
|
19
|
-
buttons: number;
|
|
20
|
-
isPrimary: boolean;
|
|
21
|
-
width: number;
|
|
22
|
-
height: number;
|
|
23
|
-
tiltX: number;
|
|
24
|
-
tiltY: number;
|
|
25
|
-
pointerType: string;
|
|
26
|
-
pointerId: number;
|
|
27
|
-
pressure: number;
|
|
28
|
-
twist: number;
|
|
29
|
-
tangentialPressure: number;
|
|
30
|
-
layerY: number;
|
|
31
|
-
offsetX: number;
|
|
32
|
-
offsetY: number;
|
|
18
|
+
export interface FormattedTouchEvent {
|
|
33
19
|
isNormalized: boolean;
|
|
34
20
|
type: string;
|
|
35
21
|
/**
|
|
22
|
+
* we don't implement TouchList here
|
|
23
|
+
*
|
|
36
24
|
* @see https://developer.mozilla.org/zh-CN/docs/Web/API/TouchEvent/changedTouches
|
|
37
25
|
*/
|
|
38
26
|
changedTouches: FormattedTouch[];
|
|
@@ -40,4 +28,18 @@ export interface FormattedTouch extends Touch {
|
|
|
40
28
|
* @see https://developer.mozilla.org/zh-CN/docs/Web/API/TouchEvent/touches
|
|
41
29
|
*/
|
|
42
30
|
touches: FormattedTouch[];
|
|
31
|
+
/**
|
|
32
|
+
* @see https://developer.mozilla.org/zh-CN/docs/Web/API/TouchEvent/targetTouches
|
|
33
|
+
*/
|
|
34
|
+
targetTouches: FormattedTouch[];
|
|
35
|
+
}
|
|
36
|
+
export interface FormattedTouch extends Touch {
|
|
37
|
+
x: number;
|
|
38
|
+
y: number;
|
|
39
|
+
canvasX: number;
|
|
40
|
+
canvasY: number;
|
|
41
|
+
viewportX: number;
|
|
42
|
+
viewportY: number;
|
|
43
|
+
target: IEventTarget | null;
|
|
44
|
+
nativeTouch: Touch;
|
|
43
45
|
}
|
|
@@ -0,0 +1,280 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* a lite tapable implementation
|
|
3
|
+
* borrow from https://github.com/funnyecho/hamon
|
|
4
|
+
*/
|
|
5
|
+
declare type Measure<T extends number> = T extends 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 ? T : never;
|
|
6
|
+
declare type Append<T extends any[], U> = {
|
|
7
|
+
0: [U];
|
|
8
|
+
1: [T[0], U];
|
|
9
|
+
2: [T[0], T[1], U];
|
|
10
|
+
3: [T[0], T[1], T[2], U];
|
|
11
|
+
4: [T[0], T[1], T[2], T[3], U];
|
|
12
|
+
5: [T[0], T[1], T[2], T[3], T[4], U];
|
|
13
|
+
6: [T[0], T[1], T[2], T[3], T[4], T[5], U];
|
|
14
|
+
7: [T[0], T[1], T[2], T[3], T[4], T[5], T[6], U];
|
|
15
|
+
8: [T[0], T[1], T[2], T[3], T[4], T[5], T[6], T[7], U];
|
|
16
|
+
}[Measure<T['length']>];
|
|
17
|
+
declare type AsArray<T> = T extends any[] ? T : [];
|
|
18
|
+
declare type Callback<E, T> = (error?: E, result?: T) => void;
|
|
19
|
+
declare type ITapID = string;
|
|
20
|
+
declare type IHookBucketType = any;
|
|
21
|
+
declare type IHookBucketHashcode<T> = (...args: AsArray<T>) => IHookBucketType;
|
|
22
|
+
declare type IAsyncTapArgs<T, R> = Append<AsArray<T>, Callback<Error, R>>;
|
|
23
|
+
declare type ISyncTapCallback<T, R> = (...args: AsArray<T>) => R;
|
|
24
|
+
declare type IAsyncTapCallback<T, R> = (...args: IAsyncTapArgs<T, R>) => void;
|
|
25
|
+
declare type IPromiseTapCallback<T, R> = (...args: AsArray<T>) => Promise<R>;
|
|
26
|
+
export declare type ITapDestroy = () => void;
|
|
27
|
+
interface ITapOptions<T, R> {
|
|
28
|
+
fn: IAsyncTapCallback<T, R> | ISyncTapCallback<T, R>;
|
|
29
|
+
bucket: string;
|
|
30
|
+
}
|
|
31
|
+
interface IInvokeSeriesObserver<T, R> {
|
|
32
|
+
shouldBail?: boolean;
|
|
33
|
+
shouldWaterfall?: boolean;
|
|
34
|
+
onComplete?: (err: Error, result?: R) => void;
|
|
35
|
+
}
|
|
36
|
+
interface IInvokeParallelObserver<T, R> {
|
|
37
|
+
shouldBail?: boolean;
|
|
38
|
+
onComplete?: (err: Error, result?: R) => void;
|
|
39
|
+
}
|
|
40
|
+
interface IInvokeSynchronouslyObserver<T, R> {
|
|
41
|
+
shouldBail?: boolean;
|
|
42
|
+
shouldWaterfall?: boolean;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Basic Hook Type
|
|
46
|
+
*
|
|
47
|
+
* @remarks
|
|
48
|
+
* All subtype hooks are extends from `Hook` which provide the tapping and calling logic
|
|
49
|
+
*
|
|
50
|
+
* @param T - tuple types of calling arguments
|
|
51
|
+
* @param R - returning value type of calling
|
|
52
|
+
*
|
|
53
|
+
* @public
|
|
54
|
+
* */
|
|
55
|
+
export declare abstract class Hook<T, R> {
|
|
56
|
+
private tapIdSeed;
|
|
57
|
+
/**
|
|
58
|
+
* @internal
|
|
59
|
+
* */
|
|
60
|
+
protected readonly bucketHashcode: IHookBucketHashcode<T>;
|
|
61
|
+
/**
|
|
62
|
+
* @internal
|
|
63
|
+
* */
|
|
64
|
+
protected readonly presetTapBucket: Set<ITapID>;
|
|
65
|
+
/**
|
|
66
|
+
* @internal
|
|
67
|
+
* */
|
|
68
|
+
protected readonly tapBuckets: Map<IHookBucketType, Set<ITapID>>;
|
|
69
|
+
/**
|
|
70
|
+
* @internal
|
|
71
|
+
* */
|
|
72
|
+
protected readonly tapOptionsCache: Map<ITapID, ITapOptions<T, R>>;
|
|
73
|
+
/**
|
|
74
|
+
* @param bucketHashcode - calculate the hashcode value of calling arguments
|
|
75
|
+
* */
|
|
76
|
+
constructor(bucketHashcode?: IHookBucketHashcode<T>);
|
|
77
|
+
/**
|
|
78
|
+
* clear all tapping from hook
|
|
79
|
+
*
|
|
80
|
+
* @public
|
|
81
|
+
* */
|
|
82
|
+
exhaust(): void;
|
|
83
|
+
/**
|
|
84
|
+
* clear all tapping from hook
|
|
85
|
+
*
|
|
86
|
+
* @remarks
|
|
87
|
+
* The same as `exhaust` {@link Hook.exhaust}
|
|
88
|
+
*
|
|
89
|
+
* @privateRemarks
|
|
90
|
+
* call `exhaust`
|
|
91
|
+
*
|
|
92
|
+
* @public
|
|
93
|
+
* */
|
|
94
|
+
destroy(): void;
|
|
95
|
+
/**
|
|
96
|
+
* @internal
|
|
97
|
+
* */
|
|
98
|
+
protected insertSyncTap(fn: ISyncTapCallback<T, R>, bucket?: IHookBucketType): ITapDestroy;
|
|
99
|
+
/**
|
|
100
|
+
* @internal
|
|
101
|
+
* */
|
|
102
|
+
protected insertAsyncTap(fn: IAsyncTapCallback<T, R>, bucket?: IHookBucketType): ITapDestroy;
|
|
103
|
+
/**
|
|
104
|
+
* @internal
|
|
105
|
+
* */
|
|
106
|
+
protected insertPromiseTap(fn: IPromiseTapCallback<T, R | void>, bucket?: IHookBucketType): ITapDestroy;
|
|
107
|
+
/**
|
|
108
|
+
* @internal
|
|
109
|
+
* */
|
|
110
|
+
protected invokeSeries(args: AsArray<T>, observer?: IInvokeSeriesObserver<T, R>): void;
|
|
111
|
+
/**
|
|
112
|
+
* @internal
|
|
113
|
+
* */
|
|
114
|
+
protected invokeParallel(args: AsArray<T>, observer?: IInvokeParallelObserver<T, R>): void;
|
|
115
|
+
/**
|
|
116
|
+
* @internal
|
|
117
|
+
* */
|
|
118
|
+
protected invokeSynchronously(args: AsArray<T>, observer?: IInvokeSynchronouslyObserver<T, R>): R;
|
|
119
|
+
/**
|
|
120
|
+
* @internal
|
|
121
|
+
* */
|
|
122
|
+
protected getBucketTaps(args: AsArray<T>): Set<ITapOptions<T, R>>;
|
|
123
|
+
/**
|
|
124
|
+
* @internal
|
|
125
|
+
* */
|
|
126
|
+
private tapping;
|
|
127
|
+
/**
|
|
128
|
+
* @internal
|
|
129
|
+
* */
|
|
130
|
+
protected popoutTap(tapId: ITapID): void;
|
|
131
|
+
/**
|
|
132
|
+
* @internal
|
|
133
|
+
* */
|
|
134
|
+
private generateTapId;
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Abstract Sync Hook
|
|
138
|
+
*
|
|
139
|
+
* @remarks
|
|
140
|
+
* Providing `tap` method for synchronous hooks
|
|
141
|
+
*
|
|
142
|
+
* @public
|
|
143
|
+
* */
|
|
144
|
+
export declare abstract class SyncTapHook<T, R> extends Hook<T, R> {
|
|
145
|
+
/**
|
|
146
|
+
* listen to hook
|
|
147
|
+
*
|
|
148
|
+
* @param fn - Listener callback
|
|
149
|
+
* @param bucket - Listen to specified hashcode bucket
|
|
150
|
+
* @returns The unTap function
|
|
151
|
+
*
|
|
152
|
+
* @public
|
|
153
|
+
* */
|
|
154
|
+
tap(fn: ISyncTapCallback<T, R>, bucket?: IHookBucketType): ITapDestroy;
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Abstract Async Hook
|
|
158
|
+
*
|
|
159
|
+
* @remarks
|
|
160
|
+
* Providing `tapAsync` and `tapPromise` methods for asynchronous hooks
|
|
161
|
+
*
|
|
162
|
+
* @public
|
|
163
|
+
* */
|
|
164
|
+
export declare abstract class AsyncTapHook<T, R> extends Hook<T, R> {
|
|
165
|
+
/**
|
|
166
|
+
* listen to hook in async callback mode
|
|
167
|
+
*
|
|
168
|
+
* @param fn - Listener callback
|
|
169
|
+
* The last argument of `fn` which named `cb` will be a function which signature is `(err?: Error, result?: T) => void`.
|
|
170
|
+
* When error occur, pass the error to `cb` as first param and the `result` param should be void,
|
|
171
|
+
* Otherwise, first param must be void.
|
|
172
|
+
*
|
|
173
|
+
* @param bucket - Listen to specified hashcode bucket
|
|
174
|
+
* @returns The unTap function
|
|
175
|
+
*
|
|
176
|
+
* @public
|
|
177
|
+
* */
|
|
178
|
+
tapAsync(fn: IAsyncTapCallback<T, R>, bucket?: IHookBucketType): ITapDestroy;
|
|
179
|
+
/**
|
|
180
|
+
* listen to hook in async promise mode
|
|
181
|
+
*
|
|
182
|
+
* @param fn - Listener callback
|
|
183
|
+
* When tapping success, return resolved promise.
|
|
184
|
+
* Otherwise, throw error or return rejected promise.
|
|
185
|
+
*
|
|
186
|
+
* @param bucket - Listen to specified hashcode bucket
|
|
187
|
+
* @returns The unTap function
|
|
188
|
+
*
|
|
189
|
+
* @public
|
|
190
|
+
* */
|
|
191
|
+
tapPromise(fn: IPromiseTapCallback<T, R | void>, bucket?: IHookBucketType): ITapDestroy;
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* Synchronous Hook
|
|
195
|
+
*
|
|
196
|
+
* @remarks
|
|
197
|
+
* Invoke listener Synchronously and return nothing
|
|
198
|
+
*
|
|
199
|
+
* @public
|
|
200
|
+
* */
|
|
201
|
+
export declare class SyncHook<T, R = void> extends SyncTapHook<T, R> {
|
|
202
|
+
/**
|
|
203
|
+
* call listener with `...args`
|
|
204
|
+
*
|
|
205
|
+
* @param args - rest parameters of calling arguments
|
|
206
|
+
*
|
|
207
|
+
* */
|
|
208
|
+
call(...args: AsArray<T>): void;
|
|
209
|
+
}
|
|
210
|
+
/**
|
|
211
|
+
* Synchronous Waterfall Hook
|
|
212
|
+
*
|
|
213
|
+
* @remarks
|
|
214
|
+
* Invoke listener Synchronously.
|
|
215
|
+
* Those non-undefined value returned from upstream listener, will waterfall to downstream as first element of arguments.
|
|
216
|
+
* Calling return with waterfall value of last listener.
|
|
217
|
+
*
|
|
218
|
+
* @public
|
|
219
|
+
* */
|
|
220
|
+
export declare class SyncWaterfallHook<T, R> extends SyncTapHook<T, R> {
|
|
221
|
+
/**
|
|
222
|
+
* call listener with `...args`
|
|
223
|
+
*
|
|
224
|
+
* @param args - rest parameters of calling arguments
|
|
225
|
+
* @returns waterfall value
|
|
226
|
+
* */
|
|
227
|
+
call(...args: AsArray<T>): R;
|
|
228
|
+
}
|
|
229
|
+
/**
|
|
230
|
+
* Asynchronous Parallel Hook
|
|
231
|
+
*
|
|
232
|
+
* @remarks
|
|
233
|
+
* Invoke listeners in parallel asynchronously
|
|
234
|
+
*
|
|
235
|
+
* @public
|
|
236
|
+
* */
|
|
237
|
+
export declare class AsyncParallelHook<T, R = void> extends AsyncTapHook<T, R> {
|
|
238
|
+
/**
|
|
239
|
+
* call listener with `...args` and `cb`
|
|
240
|
+
*
|
|
241
|
+
* @param args - rest parameters of calling arguments and `cb`
|
|
242
|
+
* The signature of `cb` is `(err?: Error) => void`.
|
|
243
|
+
* */
|
|
244
|
+
callAsync(...args: IAsyncTapArgs<T, R>): void;
|
|
245
|
+
/***
|
|
246
|
+
* call listener with `...args`
|
|
247
|
+
*
|
|
248
|
+
* @param args - rest parameters of calling arguments
|
|
249
|
+
* @returns Promise indicated whether calling succeed or failed
|
|
250
|
+
* */
|
|
251
|
+
callPromise(...args: AsArray<T>): Promise<R>;
|
|
252
|
+
}
|
|
253
|
+
/**
|
|
254
|
+
* Asynchronous Waterfall Hook
|
|
255
|
+
*
|
|
256
|
+
* @remarks
|
|
257
|
+
* Invoke listener in queue Asynchronously.
|
|
258
|
+
* Those non-undefined value returned from upstream listener, will waterfall to downstream as first element of arguments.
|
|
259
|
+
* Calling return with waterfall value of last listener.
|
|
260
|
+
*
|
|
261
|
+
* @public
|
|
262
|
+
* */
|
|
263
|
+
export declare class AsyncSeriesWaterfallHook<T, R> extends AsyncTapHook<T, R> {
|
|
264
|
+
/**
|
|
265
|
+
* call listener with `...args` and `cb`
|
|
266
|
+
*
|
|
267
|
+
* @param args - rest parameters of calling arguments and `cb`
|
|
268
|
+
* The signature of `cb` is `(err?: Error) => void`.
|
|
269
|
+
* */
|
|
270
|
+
callAsync(...args: IAsyncTapArgs<T, R>): void;
|
|
271
|
+
/***
|
|
272
|
+
* call listener with `...args`
|
|
273
|
+
*
|
|
274
|
+
* @param args - rest parameters of calling arguments
|
|
275
|
+
* @returns Promise indicated whether calling succeed or failed
|
|
276
|
+
* If calling succeed, promise was resolved with waterfall value.
|
|
277
|
+
* */
|
|
278
|
+
callPromise(...args: AsArray<T>): Promise<R>;
|
|
279
|
+
}
|
|
280
|
+
export {};
|