Skip to content

Commit 0f8863d

Browse files
authored
Merge pull request #1908 from VisActor/fix/glyph-subgraphic-state
fix: ignore subGraphic wich glyph set state
2 parents 14e015a + 0c3ad86 commit 0f8863d

File tree

3 files changed

+17
-17
lines changed

3 files changed

+17
-17
lines changed
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
"changes": [
33
{
44
"packageName": "@visactor/vrender-core",
5-
"comment": "feat: support afterClearRect hooks",
5+
"comment": "fix: ignore subGraphic wich glyph set state",
66
"type": "none"
77
}
88
],
99
"packageName": "@visactor/vrender-core"
10-
}
10+
}

packages/vrender-core/src/graphic/glyph.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -221,10 +221,10 @@ export class Glyph extends Graphic<IGlyphGraphicAttribute> implements IGlyph {
221221
}
222222
});
223223

224-
this.subGraphic.forEach((graphic, index) => {
225-
graphic.updateNormalAttrs(subAttrs[index]);
226-
graphic.applyStateAttrs(subAttrs[index], states, hasAnimation);
227-
});
224+
// this.subGraphic.forEach((graphic, index) => {
225+
// graphic.updateNormalAttrs(subAttrs[index]);
226+
// graphic.applyStateAttrs(subAttrs[index], states, hasAnimation);
227+
// });
228228

229229
this.updateNormalAttrs(stateAttrs);
230230
this.currentStates = states;
@@ -235,10 +235,10 @@ export class Glyph extends Graphic<IGlyphGraphicAttribute> implements IGlyph {
235235
this.stopStateAnimates();
236236
if (this.hasState() && this.normalAttrs) {
237237
this.currentStates = [];
238-
this.subGraphic.forEach(graphic => {
239-
graphic.applyStateAttrs(graphic.normalAttrs, this.currentStates, hasAnimation, true);
240-
graphic.normalAttrs = null;
241-
});
238+
// this.subGraphic.forEach(graphic => {
239+
// graphic.applyStateAttrs(graphic.normalAttrs, this.currentStates, hasAnimation, true);
240+
// graphic.normalAttrs = null;
241+
// });
242242
this.applyStateAttrs(this.normalAttrs, this.currentStates, hasAnimation, true);
243243
} else {
244244
this.currentStates = [];

packages/vrender/__tests__/graphic/graphic-state.test.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -209,18 +209,18 @@ describe('glyph-state', () => {
209209
expect(glyph.attribute).toMatchObject(glyph.glyphStates.hover.attributes);
210210
expect(glyph.normalAttrs).toMatchObject({ fillOpacity: undefined });
211211
expect(glyph.currentStates).toEqual(['hover']);
212-
expect(glyph.subGraphic[0].attribute).toMatchObject(glyph.glyphStates.hover.subAttributes[0]);
213-
expect(glyph.subGraphic[1].attribute).toMatchObject(glyph.glyphStates.hover.subAttributes[1]);
212+
// expect(glyph.subGraphic[0].attribute).toMatchObject(glyph.glyphStates.hover.subAttributes[0]);
213+
// expect(glyph.subGraphic[1].attribute).toMatchObject(glyph.glyphStates.hover.subAttributes[1]);
214214

215215
glyph.addState('selected', true);
216216
expect(glyph.attribute).toMatchObject({
217217
...glyph.glyphStates.hover.attributes,
218218
...glyph.glyphStates.selected.attributes
219219
});
220-
expect(glyph.subGraphic[0].attribute).toMatchObject({
221-
...glyph.glyphStates.hover.subAttributes[0],
222-
...glyph.glyphStates.selected.subAttributes[0]
223-
});
224-
expect(glyph.subGraphic[1].attribute).toMatchObject(glyph.glyphStates.hover.subAttributes[1]);
220+
// expect(glyph.subGraphic[0].attribute).toMatchObject({
221+
// ...glyph.glyphStates.hover.subAttributes[0],
222+
// ...glyph.glyphStates.selected.subAttributes[0]
223+
// });
224+
// expect(glyph.subGraphic[1].attribute).toMatchObject(glyph.glyphStates.hover.subAttributes[1]);
225225
});
226226
});

0 commit comments

Comments
 (0)