@visactor/vrender-core
Version:
## Description
44 lines (41 loc) • 1.84 kB
JavaScript
import { Group } from "./group";
export class ShadowRoot extends Group {
constructor(graphic) {
super({
x: 0,
y: 0
}), this.type = "shadowroot", this.shadowHost = graphic;
}
clearUpdateBoundTag() {
super.clearUpdateBoundTag(), this.shadowHost && this.shadowHost.clearUpdateBoundTag();
}
addUpdateBoundTag() {
super.addUpdateBoundTag(), this.shadowHost && this.shadowHost.addUpdateBoundTag();
}
addUpdateShapeAndBoundsTag() {
super.addUpdateShapeAndBoundsTag(), this.shadowHost && this.shadowHost.addUpdateBoundTag();
}
tryUpdateGlobalTransMatrix(clearTag = !0) {
if (this.shouldUpdateGlobalMatrix()) {
const m = this.transMatrix;
this._globalTransMatrix ? this._globalTransMatrix.setValue(m.a, m.b, m.c, m.d, m.e, m.f) : this._globalTransMatrix = m.clone(),
this.doUpdateGlobalMatrix(), clearTag && this.clearUpdateGlobalPositionTag();
}
return this._globalTransMatrix;
}
doUpdateGlobalMatrix() {
if (this.shadowHost) {
const parentMatrix = this.shadowHost.globalTransMatrix;
this._globalTransMatrix.multiply(parentMatrix.a, parentMatrix.b, parentMatrix.c, parentMatrix.d, parentMatrix.e, parentMatrix.f);
}
}
tryUpdateGlobalAABBBounds() {
return this._globalAABBBounds ? this._globalAABBBounds.setValue(this._AABBBounds.x1, this._AABBBounds.y1, this._AABBBounds.x2, this._AABBBounds.y2) : this._globalAABBBounds = this._AABBBounds.clone(),
this.shadowHost && this._globalAABBBounds.transformWithMatrix(this.shadowHost.globalTransMatrix),
this._globalAABBBounds;
}
}
export function createShadowRoot(graphic) {
return new ShadowRoot(graphic);
}
//# sourceMappingURL=shadow-root.js.map