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

【WIP】fix: fix issue with shadow bounds #899

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -719,9 +719,11 @@ export class DefaultGraphicService implements IGraphicService {
graphic?: IGraphic
) {
if (!this._validCheck(attribute, rectTheme, aabbBounds, graphic)) {
return aabbBounds;
}
if (!this.updatePathProxyAABBBounds(aabbBounds, graphic)) {
aabbBounds.clear();
if (!graphic.shadowRoot) {
return aabbBounds;
}
} else if (!this.updatePathProxyAABBBounds(aabbBounds, graphic)) {
let { width, height } = attribute;
const { x1, y1, x, y } = attribute;
width = width ?? x1 - x;
Expand Down
13 changes: 6 additions & 7 deletions packages/vrender-core/src/graphic/graphic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -331,15 +331,11 @@ export abstract class Graphic<T extends Partial<IGraphicAttribute> = Partial<IGr
protected abstract tryUpdateOBBBounds(): OBBBounds;

protected tryUpdateGlobalAABBBounds(): AABBBounds {
const b = this.AABBBounds;
if (!this._globalAABBBounds) {
this._globalAABBBounds = this.AABBBounds.clone();
this._globalAABBBounds = b.clone();
} else {
this._globalAABBBounds.setValue(
this._AABBBounds.x1,
this._AABBBounds.y1,
this._AABBBounds.x2,
this._AABBBounds.y2
);
this._globalAABBBounds.setValue(b.x1, b.y1, b.x2, b.y2);
}
// 使用parent的grloalAABBBounds
// todo: 考虑是否需要性能优化
Expand Down Expand Up @@ -959,6 +955,9 @@ export abstract class Graphic<T extends Partial<IGraphicAttribute> = Partial<IGr

protected clearUpdateBoundTag() {
this._updateTag &= UpdateTag.CLEAR_BOUNDS;
// if (this.shadowRoot) {
// this.shadowRoot.clearUpdateBoundTag();
// }
}
/**
* 更新位置tag,包括全局tag和局部tag
Expand Down
10 changes: 3 additions & 7 deletions packages/vrender-core/src/graphic/shadow-root.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,11 @@ export class ShadowRoot extends Group {
// 计算AABBBounds不受影响
// 计算globalAABBBounds
protected tryUpdateGlobalAABBBounds(): AABBBounds {
const b = this.AABBBounds;
if (!this._globalAABBBounds) {
this._globalAABBBounds = this._AABBBounds.clone();
this._globalAABBBounds = b.clone();
} else {
this._globalAABBBounds.setValue(
this._AABBBounds.x1,
this._AABBBounds.y1,
this._AABBBounds.x2,
this._AABBBounds.y2
);
this._globalAABBBounds.setValue(b.x1, b.y1, b.x2, b.y2);
}
// 使用shadowHost的grloalAABBBounds
// todo: 考虑是否需要性能优化
Expand Down
Loading