Skip to content

Commit

Permalink
fix: fix issue with chart rotate
Browse files Browse the repository at this point in the history
  • Loading branch information
neuqzxy committed Sep 24, 2024
1 parent b327c13 commit 8a48881
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 7 deletions.
11 changes: 8 additions & 3 deletions packages/vstory/src/story/character/chart/character.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ export class CharacterChart extends CharacterVisactor {
viewBox,
ticker: this._option.canvas.getStage().ticker,
visibleAll: false,
...getLayoutFromWidget(this._spec.position),
...(this._spec.options.panel ?? {}),
chartInitOptions: mergeChartOption(
{
Expand All @@ -91,12 +92,16 @@ export class CharacterChart extends CharacterVisactor {

setAttributes(attr: Record<string, any>): void {
// character 的属性
if (attr.position) {
this._spec.position = attr.position;
const { position, options } = attr;
if (position) {
this._spec.position = position;
// 位置属性
this._graphic.setAttributes({
...position
});
this._graphic.updateViewBox(this.getViewBoxFromSpec().viewBox);
}
if (attr.options) {
if (options) {
this.updateSpec(attr);
this.onSpecReady();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -246,8 +246,8 @@ export class Chart extends Rect implements IVisactorGraphic {
const rootBounds = this._getVChartBounds().expand(VIEW_BOX_EXPEND);
// 先更新位置
this.setAttributes({
x: this._globalViewBox.x1 + rootBounds.x1,
y: this._globalViewBox.y1 + rootBounds.y1,
// x: this._globalViewBox.x1 + rootBounds.x1,
// y: this._globalViewBox.y1 + rootBounds.y1,
// @ts-ignore
width: rootBounds.x2 - rootBounds.x1,
height: rootBounds.y2 - rootBounds.y1
Expand Down
2 changes: 1 addition & 1 deletion packages/vstory/src/story/character/component/character.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export abstract class CharacterComponent extends CharacterBase implements IChara
protected _initGraphics(): void {
this._group = new ComponentGroup({
...getLayoutFromWidget(this._spec.position),
angle: this._spec.options.angle,
// angle: this._spec.options.angle,
zIndex: this._spec.zIndex
});
this.option.graphicParent.add(this._group);
Expand Down
4 changes: 3 additions & 1 deletion packages/vstory/src/story/character/dsl-interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ export type IWidgetData = {
top?: WidgetNumber;
x?: WidgetNumber;
y?: WidgetNumber;
angle?: number;
anchor?: [number, number];
} & (
| {
bottom: WidgetNumber;
Expand Down Expand Up @@ -38,7 +40,7 @@ export interface IComponentCharacterSpec extends ICharacterSpecBase {
graphic: any;
text?: IEditorTextGraphicAttribute;
isResized?: boolean;
angle?: number;
// angle?: number;
shapePoints?: any;
};
}
Expand Down

0 comments on commit 8a48881

Please sign in to comment.