fix: graphics和icon取消缓存

This commit is contained in:
unanmed 2024-11-28 20:15:44 +08:00
parent 20faa0d4b9
commit 3f8e52706e
2 changed files with 28 additions and 16 deletions

View File

@ -68,12 +68,24 @@ const standardElement = (
return (_0: any, _1: any, props?: any) => { return (_0: any, _1: any, props?: any) => {
if (!props) return new Item('static'); if (!props) return new Item('static');
else { else {
const { const { type = 'static', cache = true, fall = false } = props;
type = 'static', return new Item(type, cache, fall);
enableCache = true, }
fallthrough = false };
} = props; };
return new Item(type, enableCache, fallthrough);
const standardElementNoCache = (
Item: new (
type: RenderItemPosition,
cache?: boolean,
fall?: boolean
) => RenderItem
) => {
return (_0: any, _1: any, props?: any) => {
if (!props) return new Item('static');
else {
const { type = 'static', cache = false, fall = false } = props;
return new Item(type, cache, fall);
} }
}; };
}; };
@ -169,11 +181,11 @@ tagMap.register<EDamageEvent, Damage>('damage', (_0, _1, props) => {
tagMap.register('animation', (_0, _1, props) => { tagMap.register('animation', (_0, _1, props) => {
return new Animate(); return new Animate();
}); });
tagMap.register('g-rect', standardElement(Rect)); tagMap.register('g-rect', standardElementNoCache(Rect));
tagMap.register('g-circle', standardElement(Circle)); tagMap.register('g-circle', standardElementNoCache(Circle));
tagMap.register('g-ellipse', standardElement(Ellipse)); tagMap.register('g-ellipse', standardElementNoCache(Ellipse));
tagMap.register('g-line', standardElement(Line)); tagMap.register('g-line', standardElementNoCache(Line));
tagMap.register('g-bezier', standardElement(BezierCurve)); tagMap.register('g-bezier', standardElementNoCache(BezierCurve));
tagMap.register('g-quad', standardElement(QuadraticCurve)); tagMap.register('g-quad', standardElementNoCache(QuadraticCurve));
tagMap.register('g-path', standardElement(Path)); tagMap.register('g-path', standardElementNoCache(Path));
tagMap.register('icon', standardElement(Icon)); tagMap.register('icon', standardElementNoCache(Icon));

View File

@ -25,8 +25,8 @@ export interface BaseProps {
hidden?: boolean; hidden?: boolean;
transform?: Transform; transform?: Transform;
type?: RenderItemPosition; type?: RenderItemPosition;
enableCache?: boolean; cache?: boolean;
fallthrough?: boolean; fall?: boolean;
id?: string; id?: string;
alpha?: number; alpha?: number;
composite?: GlobalCompositeOperation; composite?: GlobalCompositeOperation;