diff --git a/.changeset/shaggy-knives-jam.md b/.changeset/shaggy-knives-jam.md new file mode 100644 index 000000000..99b6dd258 --- /dev/null +++ b/.changeset/shaggy-knives-jam.md @@ -0,0 +1,6 @@ +--- +'@antv/g-plugin-device-renderer': patch +'@antv/g-camera-api': patch +--- + +Add onframe param in gotoLandmark. diff --git a/demo/perf-nodes-edges.html b/demo/perf-nodes-edges.html new file mode 100644 index 000000000..c42468afe --- /dev/null +++ b/demo/perf-nodes-edges.html @@ -0,0 +1,238 @@ + + + + + + Nodes & Edges + + + + +
+ + + + + + diff --git a/packages/g-camera-api/src/AdvancedCamera.ts b/packages/g-camera-api/src/AdvancedCamera.ts index d7ed26031..1b83d7122 100644 --- a/packages/g-camera-api/src/AdvancedCamera.ts +++ b/packages/g-camera-api/src/AdvancedCamera.ts @@ -198,6 +198,7 @@ export class AdvancedCamera extends Camera { easing: string; easingFunction: TypeEasingFunction; duration: number; + onframe: (t: number) => void; onfinish: () => void; }> = {}, ) { @@ -210,6 +211,7 @@ export class AdvancedCamera extends Camera { duration = 100, easingFunction = undefined, onfinish = undefined, + onframe = undefined, } = isNumber(options) ? { duration: options } : options; const epsilon = 0.01; @@ -284,6 +286,9 @@ export class AdvancedCamera extends Camera { this.triggerUpdate(); if (elapsed < duration) { + if (onframe) { + onframe(t); + } this.landmarkAnimationID = this.canvas.requestAnimationFrame(animate); } }; diff --git a/packages/g-plugin-device-renderer/src/drawcalls/Instanced.ts b/packages/g-plugin-device-renderer/src/drawcalls/Instanced.ts index bf264b905..379e8eb6a 100644 --- a/packages/g-plugin-device-renderer/src/drawcalls/Instanced.ts +++ b/packages/g-plugin-device-renderer/src/drawcalls/Instanced.ts @@ -711,6 +711,10 @@ export abstract class Instanced { name: string, value: any, ) { + if (objects.length === 0) { + return; + } + const stylePacked = [ 'opacity', 'fillOpacity', diff --git a/packages/g-plugin-device-renderer/src/renderer/Batch.ts b/packages/g-plugin-device-renderer/src/renderer/Batch.ts index 0c0ea6006..7e5667573 100644 --- a/packages/g-plugin-device-renderer/src/renderer/Batch.ts +++ b/packages/g-plugin-device-renderer/src/renderer/Batch.ts @@ -5,7 +5,7 @@ import type { RenderInst } from '../render/RenderInst'; /** * render order start from 0, our default camera's Z is 500 */ -export const RENDER_ORDER_SCALE = 1 / 200; +export const RENDER_ORDER_SCALE = 500 / 1000000; /** * A container for multiple display objects with the same `style`,