feat: 删除graphics元素

This commit is contained in:
unanmed 2024-11-27 23:06:32 +08:00
parent 209c28a9ff
commit c6cbdae5d5
4 changed files with 0 additions and 55 deletions

View File

@ -36,55 +36,6 @@ export const enum GraphicMode {
All = 3
}
export class Graphics extends RenderItem {
/** 排序后的子元素 */
sortedChildren: RenderItem[] = [];
/** 是否需要重排 */
private needSort: boolean = false;
protected render(
canvas: MotaOffscreenCanvas2D,
transform: Transform
): void {
const ctx = canvas.ctx;
this.sortedChildren.forEach(v => {
ctx.save();
v.renderContent(canvas, transform);
ctx.restore();
});
}
/**
* Graphics元素添加子元素Graphics元素或基于GraphicItemBase的元素
* @param child
*/
appendChild(...child: RenderItem<any>[]): void {
child.forEach(v => {
// 如果是Graphics或GraphicItemBase实例则加入子元素列表否则抛出警告并忽略本次添加
if (v instanceof Graphics || v instanceof GraphicItemBase) {
} else {
}
});
}
/**
*
*/
removeChild(...child: RenderItem<any>[]): void {}
/**
* zIndex进行重排
*/
requestSort(): void {
// 在下一帧渲染前进行排序
if (!this.needSort) {
this.needSort = true;
this.requestBeforeFrame(() => {});
}
}
}
export abstract class GraphicItemBase
extends RenderItem
implements IGraphicProperty

View File

@ -18,7 +18,6 @@ import {
DamageProps,
EllipseProps,
GL2Props,
GraphicsProps,
IconProps,
ImageProps,
LayerGroupProps,
@ -88,7 +87,6 @@ declare module 'vue/jsx-runtime' {
'layer-group': TagDefine<LayerGroupProps, ELayerGroupEvent>;
damage: TagDefine<DamageProps, EDamageEvent>;
animation: TagDefine<AnimateProps, EAnimateEvent>;
graphics: TagDefine<GraphicsProps, ERenderItemEvent>;
'g-rect': TagDefine<RectProps, ERenderItemEvent>;
'g-circle': TagDefine<CirclesProps, ERenderItemEvent>;
'g-ellipse': TagDefine<EllipseProps, ERenderItemEvent>;

View File

@ -11,7 +11,6 @@ import {
BezierCurve,
Circle,
Ellipse,
Graphics,
Line,
Path,
QuadraticCurve,
@ -170,7 +169,6 @@ tagMap.register<EDamageEvent, Damage>('damage', (_0, _1, props) => {
tagMap.register('animation', (_0, _1, props) => {
return new Animate();
});
tagMap.register('graphics', standardElement(Graphics));
tagMap.register('g-rect', standardElement(Rect));
tagMap.register('g-circle', standardElement(Circle));
tagMap.register('g-ellipse', standardElement(Ellipse));

View File

@ -90,8 +90,6 @@ export interface DamageProps extends BaseProps {
strokeWidth?: number;
}
export interface GraphicsProps extends BaseProps {}
export interface RectProps extends BaseProps {}
export interface CirclesProps extends BaseProps {}