Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[g-canvas] 相机旋转时脏矩形渲染擦除区域有误 #1116

Closed
xiaoiver opened this issue Aug 9, 2022 · 0 comments
Closed

[g-canvas] 相机旋转时脏矩形渲染擦除区域有误 #1116

xiaoiver opened this issue Aug 9, 2022 · 0 comments
Assignees
Labels

Comments

@xiaoiver
Copy link
Contributor

xiaoiver commented Aug 9, 2022

image

计算得到的脏矩形四个顶点处于 Canvas 坐标系下,需要转换到 Viewport 坐标系下:

const dirtyRect = this.convertAABB2Rect(dirtyRenderBounds);
const { x, y, width, height } = dirtyRect;

// 转换到 viewport 坐标系
const tl = vec3.transformMat4(this.vec3a, vec3.fromValues(x, y, 0), this.vpMatrix);
const tr = vec3.transformMat4(this.vec3b, vec3.fromValues(x + width, y, 0), this.vpMatrix);
const bl = vec3.transformMat4(this.vec3c, vec3.fromValues(x, y + height, 0), this.vpMatrix);
const br = vec3.transformMat4(
  this.vec3d,
  vec3.fromValues(x + width, y + height, 0),
  this.vpMatrix,
);

// 重新计算该坐标系下四个顶点
const ix = Math.floor(minx);
const iy = Math.floor(miny);
const iwidth = Math.ceil(maxx - minx);
const iheight = Math.ceil(maxy - miny);

// 擦除脏矩形
context.save();
this.clearRect(context, ix, iy, iwidth, iheight);
@xiaoiver xiaoiver self-assigned this Aug 9, 2022
@xiaoiver xiaoiver added the bug label Aug 9, 2022
xiaoiver added a commit that referenced this issue Aug 12, 2022
* feat: init annotation plugin

* feat: create selectable ui

* fix: change to the latest renderer plugin usage

* feat: add drawers

* feat: add draw & hover style

* feat: support selectable rect

* fix: move inheritable properties to parent group element #1108

* fix: use radial gradient cache in g-svg

* feat: support marker-start/end in g-webgl

* feat: support marker for polygon in g-webgl

* fix: remove annotation

* fix: resolve merge conflict

* feat: support marker offset for path #1077

* chore: add test case for marker

* chore: add integration testcase for marker

* refactor: split selectable plugin from annotation

* chore: add testcase for clippath

* Publish

 - @antv/g-canvas@1.7.0
 - @antv/g-canvaskit@0.6.0
 - @antv/g-components@1.7.0
 - @antv/g-devtool@0.10.0
 - @antv/g-gesture@0.0.19
 - @antv/g-image-exporter@0.5.0
 - @antv/g-layout-blocklike@1.7.0
 - @antv/g-math@1.7.0
 - @antv/g-mobile-canvas-element@0.6.0
 - @antv/g-mobile-canvas@0.7.0
 - @antv/g-mobile-svg@0.7.0
 - @antv/g-mobile-webgl@0.7.0
 - @antv/g-plugin-3d@1.7.0
 - @antv/g-plugin-a11y@0.4.0
 - @antv/g-plugin-annotation@0.1.0
 - @antv/g-plugin-box2d@1.7.0
 - @antv/g-plugin-canvas-path-generator@1.1.0
 - @antv/g-plugin-canvas-picker@1.7.0
 - @antv/g-plugin-canvas-renderer@1.7.0
 - @antv/g-plugin-canvaskit-renderer@1.1.0
 - @antv/g-plugin-control@1.7.0
 - @antv/g-plugin-css-select@1.7.0
 - @antv/g-plugin-device-renderer@1.7.0
 - @antv/g-plugin-dom-interaction@1.7.0
 - @antv/g-plugin-dragndrop@1.6.0
 - @antv/g-plugin-gpgpu@1.7.0
 - @antv/g-plugin-html-renderer@1.7.0
 - @antv/g-plugin-image-loader@1.1.0
 - @antv/g-plugin-matterjs@1.7.0
 - @antv/g-plugin-mobile-interaction@0.7.0
 - @antv/g-plugin-physx@1.7.0
 - @antv/g-plugin-rough-canvas-renderer@1.7.0
 - @antv/g-plugin-rough-svg-renderer@1.7.0
 - @antv/g-plugin-svg-picker@1.7.0
 - @antv/g-plugin-svg-renderer@1.7.0
 - @antv/g-plugin-webgl-device@1.7.0
 - @antv/g-plugin-webgpu-device@1.7.0
 - @antv/g-plugin-yoga@1.7.0
 - @antv/g-shader-components@1.7.0
 - @antv/g-svg@1.7.0
 - @antv/g-web-components@1.7.0
 - @antv/g-webgl@1.7.0
 - @antv/g-webgpu@1.7.0
 - @antv/g@5.7.0
 - @antv/react-g@1.7.0
 - @antv/g-site@1.7.0

* fix: custom element should trigger attribute changed callback after connected

* fix: make clippath valid on ancestor #1109

* fix: picking should account for clippath on ancestor #1109

* fix: event on/off

* Publish

 - @antv/g-canvas@1.7.1
 - @antv/g-canvaskit@0.6.1
 - @antv/g-gesture@0.0.20
 - @antv/g-mobile-canvas@0.7.1
 - @antv/g-plugin-annotation@0.1.1
 - @antv/g-plugin-canvas-picker@1.7.1
 - @antv/g-plugin-canvas-renderer@1.7.1
 - @antv/g@5.7.1
 - @antv/react-g@1.7.1

* fix: support relative length unit for dx/dy #1111

* Publish

 - @antv/g-canvas@1.7.2
 - @antv/g-canvaskit@0.6.2
 - @antv/g-gesture@0.0.21
 - @antv/g-mobile-canvas@0.7.2
 - @antv/g-mobile-webgl@0.7.1
 - @antv/g-plugin-annotation@0.1.2
 - @antv/g-plugin-canvas-renderer@1.7.2
 - @antv/g-plugin-canvaskit-renderer@1.1.1
 - @antv/g-plugin-device-renderer@1.7.1
 - @antv/g-plugin-image-loader@1.1.1
 - @antv/g-webgl@1.7.1
 - @antv/g-webgpu@1.7.1
 - @antv/g@5.7.2
 - @antv/react-g@1.7.2

* fix: use native isPointInPath method first #1112

* fix: emit draw:move event

* fix: disable drawing with right mouse

* fix: downgrade Path / Polyline to Line for better perf in g-webgl #1113

* fix: apply filter to Image & Text correctly #1114

* chore: add testcase for filter

* Publish

 - @antv/g-canvas@1.7.3
 - @antv/g-canvaskit@0.6.3
 - @antv/g-gesture@0.0.22
 - @antv/g-mobile-canvas@0.7.3
 - @antv/g-mobile-svg@0.7.1
 - @antv/g-mobile-webgl@0.7.2
 - @antv/g-plugin-annotation@0.1.3
 - @antv/g-plugin-canvas-picker@1.7.2
 - @antv/g-plugin-canvas-renderer@1.7.3
 - @antv/g-plugin-device-renderer@1.7.2
 - @antv/g-plugin-svg-renderer@1.7.1
 - @antv/g-svg@1.7.1
 - @antv/g-webgl@1.7.2
 - @antv/g-webgpu@1.7.2
 - @antv/g@5.7.3
 - @antv/react-g@1.7.3
 - @antv/g-site@1.7.1

* fix: use viewport point to render drawer

* feat: interactive event such as PointerEvent and WheelEvent can be cloned #1115

* fix: draw rect with rotation

* fix: copy event point

* fix: account for camera rotation when clearing dirty rectangle #1116

* fix: reduce re-ordering on fcp #1117

* chore: update annotation docs

Co-authored-by: yuqi.pyq <yuqi.pyq@antgroup.com>
Co-authored-by: yuanzi <liaopei.lp@antgroup.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant