mirror of
https://github.com/unanmed/HumanBreak.git
synced 2025-01-19 04:19:30 +08:00
feat: graphic的patchProp写完了
This commit is contained in:
parent
1650865a6a
commit
29f1f00e23
@ -238,6 +238,18 @@ export class Circle extends GraphicItemBase {
|
||||
parentComponent?: ComponentInternalInstance | null
|
||||
): void {
|
||||
switch (key) {
|
||||
case 'radius':
|
||||
if (!this.assertType(nextValue, 'number', key)) return;
|
||||
this.setRadius(nextValue);
|
||||
return;
|
||||
case 'start':
|
||||
if (!this.assertType(nextValue, 'number', key)) return;
|
||||
this.setAngle(nextValue,this.end);
|
||||
return;
|
||||
case 'end':
|
||||
if (!this.assertType(nextValue, 'number', key)) return;
|
||||
this.setAngle(this.start,nextValue);
|
||||
return;
|
||||
}
|
||||
super.patchProp(key, prevValue, nextValue, namespace, parentComponent);
|
||||
}
|
||||
@ -307,6 +319,22 @@ export class Ellipse extends GraphicItemBase {
|
||||
parentComponent?: ComponentInternalInstance | null
|
||||
): void {
|
||||
switch (key) {
|
||||
case 'radiusX':
|
||||
if (!this.assertType(nextValue, 'number', key)) return;
|
||||
this.setRadius(nextValue,this.radiusY);
|
||||
return;
|
||||
case 'radiusY':
|
||||
if (!this.assertType(nextValue, 'number', key)) return;
|
||||
this.setRadius(this.radiusY,nextValue);
|
||||
return;
|
||||
case 'start':
|
||||
if (!this.assertType(nextValue, 'number', key)) return;
|
||||
this.setAngle(nextValue,this.end);
|
||||
return;
|
||||
case 'end':
|
||||
if (!this.assertType(nextValue, 'number', key)) return;
|
||||
this.setAngle(this.start,nextValue);
|
||||
return;
|
||||
}
|
||||
super.patchProp(key, prevValue, nextValue, namespace, parentComponent);
|
||||
}
|
||||
@ -357,6 +385,22 @@ export class Line extends GraphicItemBase {
|
||||
parentComponent?: ComponentInternalInstance | null
|
||||
): void {
|
||||
switch (key) {
|
||||
case 'x1':
|
||||
if (!this.assertType(nextValue, 'number', key)) return;
|
||||
this.setPoint1(nextValue,this.y1);
|
||||
return;
|
||||
case 'y1':
|
||||
if (!this.assertType(nextValue, 'number', key)) return;
|
||||
this.setPoint1(this.x1,nextValue);
|
||||
return;
|
||||
case 'x2':
|
||||
if (!this.assertType(nextValue, 'number', key)) return;
|
||||
this.setPoint2(nextValue,this.y2);
|
||||
return;
|
||||
case 'y2':
|
||||
if (!this.assertType(nextValue, 'number', key)) return;
|
||||
this.setPoint2(this.x2,nextValue);
|
||||
return;
|
||||
}
|
||||
super.patchProp(key, prevValue, nextValue, namespace, parentComponent);
|
||||
}
|
||||
@ -428,6 +472,38 @@ export class BezierCurve extends GraphicItemBase {
|
||||
parentComponent?: ComponentInternalInstance | null
|
||||
): void {
|
||||
switch (key) {
|
||||
case 'sx':
|
||||
if (!this.assertType(nextValue, 'number', key)) return;
|
||||
this.setStart(nextValue,this.sy);
|
||||
return;
|
||||
case 'sy':
|
||||
if (!this.assertType(nextValue, 'number', key)) return;
|
||||
this.setStart(this.sx,nextValue);
|
||||
return;
|
||||
case 'cp1x':
|
||||
if (!this.assertType(nextValue, 'number', key)) return;
|
||||
this.setControl1(nextValue,this.cp1y);
|
||||
return;
|
||||
case 'cp1y':
|
||||
if (!this.assertType(nextValue, 'number', key)) return;
|
||||
this.setControl1(this.cp1x,nextValue);
|
||||
return;
|
||||
case 'cp2x':
|
||||
if (!this.assertType(nextValue, 'number', key)) return;
|
||||
this.setControl2(nextValue,this.cp2y);
|
||||
return;
|
||||
case 'cp2y':
|
||||
if (!this.assertType(nextValue, 'number', key)) return;
|
||||
this.setControl2(this.cp2x,nextValue);
|
||||
return;
|
||||
case 'ex':
|
||||
if (!this.assertType(nextValue, 'number', key)) return;
|
||||
this.setEnd(nextValue,this.ey);
|
||||
return;
|
||||
case 'ey':
|
||||
if (!this.assertType(nextValue, 'number', key)) return;
|
||||
this.setEnd(this.ex,nextValue);
|
||||
return;
|
||||
}
|
||||
super.patchProp(key, prevValue, nextValue, namespace, parentComponent);
|
||||
}
|
||||
@ -488,6 +564,30 @@ export class QuadraticCurve extends GraphicItemBase {
|
||||
parentComponent?: ComponentInternalInstance | null
|
||||
): void {
|
||||
switch (key) {
|
||||
case 'sx':
|
||||
if (!this.assertType(nextValue, 'number', key)) return;
|
||||
this.setStart(nextValue,this.sy);
|
||||
return;
|
||||
case 'sy':
|
||||
if (!this.assertType(nextValue, 'number', key)) return;
|
||||
this.setStart(this.sx,nextValue);
|
||||
return;
|
||||
case 'cpx':
|
||||
if (!this.assertType(nextValue, 'number', key)) return;
|
||||
this.setControl(nextValue,this.cpy);
|
||||
return;
|
||||
case 'cpy':
|
||||
if (!this.assertType(nextValue, 'number', key)) return;
|
||||
this.setControl(this.cpx,nextValue);
|
||||
return;
|
||||
case 'ex':
|
||||
if (!this.assertType(nextValue, 'number', key)) return;
|
||||
this.setEnd(nextValue,this.ey);
|
||||
return;
|
||||
case 'ey':
|
||||
if (!this.assertType(nextValue, 'number', key)) return;
|
||||
this.setEnd(this.ex,nextValue);
|
||||
return;
|
||||
}
|
||||
super.patchProp(key, prevValue, nextValue, namespace, parentComponent);
|
||||
}
|
||||
@ -545,6 +645,11 @@ export class Path extends GraphicItemBase {
|
||||
parentComponent?: ComponentInternalInstance | null
|
||||
): void {
|
||||
switch (key) {
|
||||
case 'path':
|
||||
if (!this.assertType(nextValue, Path2D, key)) return;
|
||||
this.path = nextValue;
|
||||
this.update();
|
||||
return;
|
||||
}
|
||||
super.patchProp(key, prevValue, nextValue, namespace, parentComponent);
|
||||
}
|
||||
|
@ -108,17 +108,49 @@ export interface GraphicPropsBase extends BaseProps, Partial<ILineProperty> {
|
||||
|
||||
export interface RectProps extends GraphicPropsBase {}
|
||||
|
||||
export interface CirclesProps extends GraphicPropsBase {}
|
||||
export interface CirclesProps extends GraphicPropsBase {
|
||||
radius?: number;
|
||||
start?: number;
|
||||
end?: number;
|
||||
}
|
||||
|
||||
export interface EllipseProps extends GraphicPropsBase {}
|
||||
export interface EllipseProps extends GraphicPropsBase {
|
||||
radiusX?: number;
|
||||
radiusY?: number;
|
||||
start?: number;
|
||||
end?: number;
|
||||
}
|
||||
|
||||
export interface LineProps extends GraphicPropsBase {}
|
||||
export interface LineProps extends GraphicPropsBase {
|
||||
x1?: number;
|
||||
y1?: number;
|
||||
x2?: number;
|
||||
y2?: number;
|
||||
}
|
||||
|
||||
export interface BezierProps extends GraphicPropsBase {}
|
||||
export interface BezierProps extends GraphicPropsBase {
|
||||
sx?: number;
|
||||
sy?: number;
|
||||
cp1x?: number;
|
||||
cp1y?: number;
|
||||
cp2x?: number;
|
||||
cp2y?: number;
|
||||
ex?: number;
|
||||
ey?: number;
|
||||
}
|
||||
|
||||
export interface QuadraticProps extends GraphicPropsBase {}
|
||||
export interface QuadraticProps extends GraphicPropsBase {
|
||||
sx?: number;
|
||||
sy?: number;
|
||||
cpx?: number;
|
||||
cpy?: number;
|
||||
ex?: number;
|
||||
ey?: number;
|
||||
}
|
||||
|
||||
export interface PathProps extends GraphicPropsBase {}
|
||||
export interface PathProps extends GraphicPropsBase {
|
||||
path?: Path2D;
|
||||
}
|
||||
|
||||
export interface IconProps extends BaseProps {}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user