@antv/g-lite 1.2.21 → 1.2.22
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 +41 -1
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +41 -1
- 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) {
|
|
@@ -11734,6 +11760,7 @@ runtime.globalThis = getGlobalThis();
|
|
|
11734
11760
|
runtime.enableCSSParsing = true;
|
|
11735
11761
|
runtime.enableDataset = false;
|
|
11736
11762
|
runtime.enableStyleSyntax = true;
|
|
11763
|
+
runtime.enableSizeAttenuation = false;
|
|
11737
11764
|
|
|
11738
11765
|
var entityCounter = 0;
|
|
11739
11766
|
function resetEntityCounter() {
|
|
@@ -14873,6 +14900,9 @@ var PrepareRendererPlugin = /** @class */ (function () {
|
|
|
14873
14900
|
};
|
|
14874
14901
|
var handleMounted = function (e) {
|
|
14875
14902
|
var object = e.target;
|
|
14903
|
+
if (runtime.enableSizeAttenuation) {
|
|
14904
|
+
runtime.styleValueRegistry.updateSizeAttenuation(object, canvas.getCamera().getZoom());
|
|
14905
|
+
}
|
|
14876
14906
|
if (runtime.enableCSSParsing) {
|
|
14877
14907
|
// recalc style values
|
|
14878
14908
|
runtime.styleValueRegistry.recalc(object);
|
|
@@ -15115,10 +15145,20 @@ var Canvas = /** @class */ (function (_super) {
|
|
|
15115
15145
|
// redraw when camera changed
|
|
15116
15146
|
camera.eventEmitter.on(CameraEvent.UPDATED, function () {
|
|
15117
15147
|
_this.context.renderingContext.renderReasons.add(RenderReason.CAMERA_CHANGED);
|
|
15148
|
+
if (runtime.enableSizeAttenuation &&
|
|
15149
|
+
_this.getConfig().renderer.getConfig().enableSizeAttenuation) {
|
|
15150
|
+
_this.updateSizeAttenuation();
|
|
15151
|
+
}
|
|
15118
15152
|
});
|
|
15119
15153
|
// bind camera
|
|
15120
15154
|
this.context.camera = camera;
|
|
15121
15155
|
};
|
|
15156
|
+
Canvas.prototype.updateSizeAttenuation = function () {
|
|
15157
|
+
var zoom = this.getCamera().getZoom();
|
|
15158
|
+
this.document.documentElement.forEach(function (node) {
|
|
15159
|
+
runtime.styleValueRegistry.updateSizeAttenuation(node, zoom);
|
|
15160
|
+
});
|
|
15161
|
+
};
|
|
15122
15162
|
Canvas.prototype.getConfig = function () {
|
|
15123
15163
|
return this.context.config;
|
|
15124
15164
|
};
|