@antv/g-lite 1.2.21 → 1.2.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/Canvas.d.ts +2 -1
- package/dist/css/StyleValueRegistry.d.ts +1 -0
- package/dist/css/interfaces.d.ts +1 -0
- package/dist/display-objects/Ellipse.d.ts +2 -0
- package/dist/display-objects/Polygon.d.ts +2 -0
- package/dist/display-objects/Rect.d.ts +2 -0
- package/dist/global-runtime.d.ts +1 -0
- package/dist/index.esm.js +47 -13
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +47 -13
- package/dist/index.js.map +1 -1
- package/dist/index.umd.min.js +1 -1
- package/dist/index.umd.min.js.map +1 -1
- package/dist/types.d.ts +4 -0
- package/package.json +1 -1
package/dist/Canvas.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ import { CustomElementRegistry } from './dom/CustomElementRegistry';
|
|
|
6
6
|
import type { ICanvas } from './dom/interfaces';
|
|
7
7
|
import { EventService, RenderingService } from './services';
|
|
8
8
|
import type { PointLike } from './shapes';
|
|
9
|
-
import type
|
|
9
|
+
import { type CanvasConfig, type Cursor, type InteractivePointerEvent } from './types';
|
|
10
10
|
export declare function isCanvas(value: any): value is Canvas;
|
|
11
11
|
export declare enum CanvasEvent {
|
|
12
12
|
READY = "ready",
|
|
@@ -81,6 +81,7 @@ export declare class Canvas extends EventTarget implements ICanvas {
|
|
|
81
81
|
constructor(config: CanvasConfig);
|
|
82
82
|
private initRenderingContext;
|
|
83
83
|
private initDefaultCamera;
|
|
84
|
+
private updateSizeAttenuation;
|
|
84
85
|
getConfig(): Partial<CanvasConfig>;
|
|
85
86
|
/**
|
|
86
87
|
* get the root displayObject in scenegraph
|
package/dist/css/interfaces.d.ts
CHANGED
|
@@ -122,6 +122,7 @@ export interface PropertyParseOptions {
|
|
|
122
122
|
}
|
|
123
123
|
export interface StyleValueRegistry {
|
|
124
124
|
recalc: (displayObject: DisplayObject) => void;
|
|
125
|
+
updateSizeAttenuation: (displayObject: DisplayObject, zoom: number) => void;
|
|
125
126
|
registerMetadata: (metadata: PropertyMetadata) => void;
|
|
126
127
|
unregisterMetadata: (name: string) => void;
|
|
127
128
|
getPropertySyntax: (syntax: string) => CSSProperty<any, any>;
|
|
@@ -8,6 +8,7 @@ export interface EllipseStyleProps extends BaseStyleProps {
|
|
|
8
8
|
rx: number | string;
|
|
9
9
|
ry: number | string;
|
|
10
10
|
isBillboard?: boolean;
|
|
11
|
+
isSizeAttenuation?: boolean;
|
|
11
12
|
}
|
|
12
13
|
export interface ParsedEllipseStyleProps extends ParsedBaseStyleProps {
|
|
13
14
|
cx: number;
|
|
@@ -16,6 +17,7 @@ export interface ParsedEllipseStyleProps extends ParsedBaseStyleProps {
|
|
|
16
17
|
rx: number;
|
|
17
18
|
ry: number;
|
|
18
19
|
isBillboard?: boolean;
|
|
20
|
+
isSizeAttenuation?: boolean;
|
|
19
21
|
}
|
|
20
22
|
export declare class Ellipse extends DisplayObject<EllipseStyleProps, ParsedEllipseStyleProps> {
|
|
21
23
|
constructor({ style, ...rest }?: DisplayObjectConfig<EllipseStyleProps>);
|
|
@@ -22,6 +22,7 @@ export interface PolygonStyleProps extends BaseStyleProps {
|
|
|
22
22
|
markerEndOffset?: number;
|
|
23
23
|
isClosed?: boolean;
|
|
24
24
|
isBillboard?: boolean;
|
|
25
|
+
isSizeAttenuation?: boolean;
|
|
25
26
|
}
|
|
26
27
|
export interface ParsedPolygonStyleProps extends ParsedBaseStyleProps {
|
|
27
28
|
points: {
|
|
@@ -36,6 +37,7 @@ export interface ParsedPolygonStyleProps extends ParsedBaseStyleProps {
|
|
|
36
37
|
markerEndOffset?: number;
|
|
37
38
|
isClosed?: boolean;
|
|
38
39
|
isBillboard?: boolean;
|
|
40
|
+
isSizeAttenuation?: boolean;
|
|
39
41
|
}
|
|
40
42
|
export declare class Polygon extends DisplayObject<PolygonStyleProps, ParsedPolygonStyleProps> {
|
|
41
43
|
private markerStartAngle;
|
|
@@ -8,6 +8,7 @@ export interface RectStyleProps extends BaseStyleProps {
|
|
|
8
8
|
width: number | string;
|
|
9
9
|
height: number | string;
|
|
10
10
|
isBillboard?: boolean;
|
|
11
|
+
isSizeAttenuation?: boolean;
|
|
11
12
|
/**
|
|
12
13
|
* top-left, top-right, bottom-right, bottom-left
|
|
13
14
|
*/
|
|
@@ -20,6 +21,7 @@ export interface ParsedRectStyleProps extends ParsedBaseStyleProps {
|
|
|
20
21
|
width: number;
|
|
21
22
|
height: number;
|
|
22
23
|
isBillboard?: boolean;
|
|
24
|
+
isSizeAttenuation?: boolean;
|
|
23
25
|
radius?: [number, number, number, number];
|
|
24
26
|
}
|
|
25
27
|
export declare class Rect extends DisplayObject<RectStyleProps, ParsedRectStyleProps> {
|
package/dist/global-runtime.d.ts
CHANGED
package/dist/index.esm.js
CHANGED
|
@@ -641,7 +641,7 @@ var AbstractRenderer = /** @class */ (function () {
|
|
|
641
641
|
/**
|
|
642
642
|
* enable dirty rectangle rendering by default
|
|
643
643
|
*/
|
|
644
|
-
enableDirtyRectangleRendering: true, enableDirtyRectangleRenderingDebug: false }, config);
|
|
644
|
+
enableDirtyRectangleRendering: true, enableDirtyRectangleRenderingDebug: false, enableSizeAttenuation: true }, config);
|
|
645
645
|
}
|
|
646
646
|
AbstractRenderer.prototype.registerPlugin = function (plugin) {
|
|
647
647
|
var index = this.plugins.findIndex(function (p) { return p === plugin; });
|
|
@@ -7173,6 +7173,32 @@ var DefaultStyleValueRegistry = /** @class */ (function () {
|
|
|
7173
7173
|
this.runtime.sceneGraphService.dirtifyToRoot(object);
|
|
7174
7174
|
}
|
|
7175
7175
|
};
|
|
7176
|
+
DefaultStyleValueRegistry.prototype.updateSizeAttenuation = function (node, zoom) {
|
|
7177
|
+
if (node.style.isSizeAttenuation) {
|
|
7178
|
+
if (!node.style.rawLineWidth) {
|
|
7179
|
+
node.style.rawLineWidth = node.style.lineWidth;
|
|
7180
|
+
}
|
|
7181
|
+
node.style.lineWidth = node.style.rawLineWidth / zoom;
|
|
7182
|
+
if (node.nodeName === Shape.CIRCLE) {
|
|
7183
|
+
if (!node.style.rawR) {
|
|
7184
|
+
node.style.rawR = node.style.r;
|
|
7185
|
+
}
|
|
7186
|
+
node.style.r = node.style.rawR / zoom;
|
|
7187
|
+
}
|
|
7188
|
+
}
|
|
7189
|
+
else {
|
|
7190
|
+
if (node.style.rawLineWidth) {
|
|
7191
|
+
node.style.lineWidth = node.style.rawLineWidth;
|
|
7192
|
+
delete node.style.rawLineWidth;
|
|
7193
|
+
}
|
|
7194
|
+
if (node.nodeName === Shape.CIRCLE) {
|
|
7195
|
+
if (node.style.rawR) {
|
|
7196
|
+
node.style.r = node.style.rawR;
|
|
7197
|
+
delete node.style.rawR;
|
|
7198
|
+
}
|
|
7199
|
+
}
|
|
7200
|
+
}
|
|
7201
|
+
};
|
|
7176
7202
|
DefaultStyleValueRegistry.prototype.isPropertyInheritable = function (name) {
|
|
7177
7203
|
var metadata = propertyMetadataCache[name];
|
|
7178
7204
|
if (!metadata) {
|
|
@@ -11104,6 +11130,9 @@ var DefaultSceneGraphService = /** @class */ (function () {
|
|
|
11104
11130
|
}
|
|
11105
11131
|
}
|
|
11106
11132
|
});
|
|
11133
|
+
if (!aabb) {
|
|
11134
|
+
aabb = new AABB();
|
|
11135
|
+
}
|
|
11107
11136
|
if (render) {
|
|
11108
11137
|
// FIXME: account for clip path
|
|
11109
11138
|
var clipped = findClosestClipPathTarget(element);
|
|
@@ -11111,28 +11140,19 @@ var DefaultSceneGraphService = /** @class */ (function () {
|
|
|
11111
11140
|
// use bounds under world space
|
|
11112
11141
|
var clipPathBounds = clipped.parsedStyle.clipPath.getBounds(render);
|
|
11113
11142
|
if (!aabb) {
|
|
11114
|
-
aabb
|
|
11143
|
+
aabb.update(clipPathBounds.center, clipPathBounds.halfExtents);
|
|
11115
11144
|
}
|
|
11116
11145
|
else if (clipPathBounds) {
|
|
11117
11146
|
aabb = clipPathBounds.intersection(aabb);
|
|
11118
11147
|
}
|
|
11119
11148
|
}
|
|
11120
11149
|
}
|
|
11121
|
-
if (!aabb) {
|
|
11122
|
-
aabb = new AABB();
|
|
11123
|
-
}
|
|
11124
|
-
if (aabb) {
|
|
11125
|
-
if (render) {
|
|
11126
|
-
renderable.renderBounds = aabb;
|
|
11127
|
-
}
|
|
11128
|
-
else {
|
|
11129
|
-
renderable.bounds = aabb;
|
|
11130
|
-
}
|
|
11131
|
-
}
|
|
11132
11150
|
if (render) {
|
|
11151
|
+
renderable.renderBounds = aabb;
|
|
11133
11152
|
renderable.renderBoundsDirty = false;
|
|
11134
11153
|
}
|
|
11135
11154
|
else {
|
|
11155
|
+
renderable.bounds = aabb;
|
|
11136
11156
|
renderable.boundsDirty = false;
|
|
11137
11157
|
}
|
|
11138
11158
|
return aabb;
|
|
@@ -11734,6 +11754,7 @@ runtime.globalThis = getGlobalThis();
|
|
|
11734
11754
|
runtime.enableCSSParsing = true;
|
|
11735
11755
|
runtime.enableDataset = false;
|
|
11736
11756
|
runtime.enableStyleSyntax = true;
|
|
11757
|
+
runtime.enableSizeAttenuation = false;
|
|
11737
11758
|
|
|
11738
11759
|
var entityCounter = 0;
|
|
11739
11760
|
function resetEntityCounter() {
|
|
@@ -14873,6 +14894,9 @@ var PrepareRendererPlugin = /** @class */ (function () {
|
|
|
14873
14894
|
};
|
|
14874
14895
|
var handleMounted = function (e) {
|
|
14875
14896
|
var object = e.target;
|
|
14897
|
+
if (runtime.enableSizeAttenuation) {
|
|
14898
|
+
runtime.styleValueRegistry.updateSizeAttenuation(object, canvas.getCamera().getZoom());
|
|
14899
|
+
}
|
|
14876
14900
|
if (runtime.enableCSSParsing) {
|
|
14877
14901
|
// recalc style values
|
|
14878
14902
|
runtime.styleValueRegistry.recalc(object);
|
|
@@ -15115,10 +15139,20 @@ var Canvas = /** @class */ (function (_super) {
|
|
|
15115
15139
|
// redraw when camera changed
|
|
15116
15140
|
camera.eventEmitter.on(CameraEvent.UPDATED, function () {
|
|
15117
15141
|
_this.context.renderingContext.renderReasons.add(RenderReason.CAMERA_CHANGED);
|
|
15142
|
+
if (runtime.enableSizeAttenuation &&
|
|
15143
|
+
_this.getConfig().renderer.getConfig().enableSizeAttenuation) {
|
|
15144
|
+
_this.updateSizeAttenuation();
|
|
15145
|
+
}
|
|
15118
15146
|
});
|
|
15119
15147
|
// bind camera
|
|
15120
15148
|
this.context.camera = camera;
|
|
15121
15149
|
};
|
|
15150
|
+
Canvas.prototype.updateSizeAttenuation = function () {
|
|
15151
|
+
var zoom = this.getCamera().getZoom();
|
|
15152
|
+
this.document.documentElement.forEach(function (node) {
|
|
15153
|
+
runtime.styleValueRegistry.updateSizeAttenuation(node, zoom);
|
|
15154
|
+
});
|
|
15155
|
+
};
|
|
15122
15156
|
Canvas.prototype.getConfig = function () {
|
|
15123
15157
|
return this.context.config;
|
|
15124
15158
|
};
|