psl调整

This commit is contained in:
fan 2023-10-08 10:43:17 +08:00
parent 2b31e14d90
commit 8a995bf63b
15 changed files with 1 additions and 303 deletions

@ -1 +1 @@
Subproject commit 19514bc55091b2afb559d6e6f9a3c1e3b2699be1
Subproject commit 8403e90692f1848d38b7928ba3b9ecfe3f381722

View File

@ -8,14 +8,6 @@
label="Psl按钮"
lazy-rules
/>
<q-input
outlined
class="q-mt-sm"
v-model="pslButtonModel.topAnnotation"
@blur="onUpdate"
label="上方注释"
lazy-rules
/>
<q-select
outlined
class="q-mt-sm"

View File

@ -8,22 +8,6 @@
label="Psl钥匙"
lazy-rules
/>
<q-input
outlined
class="q-mt-sm"
v-model="pslKeyModel.topAnnotation"
@blur="onUpdate"
label="上方注释"
lazy-rules
/>
<q-input
outlined
class="q-mt-sm"
v-model="pslKeyModel.rightAnnotation"
@blur="onUpdate"
label="右侧注释"
lazy-rules
/>
</q-form>
</template>

View File

@ -8,14 +8,6 @@
label="Psl按钮"
lazy-rules
/>
<q-input
outlined
class="q-mt-sm"
v-model="pslLightModel.topAnnotation"
@blur="onUpdate"
label="上方注释"
lazy-rules
/>
<q-select
outlined
class="q-mt-sm"

View File

@ -26,12 +26,6 @@ export class PslButtonData extends GraphicDataBase implements IPslButtonData {
set code(v: string) {
this.data.code = v;
}
get topAnnotation(): string {
return this.data.topAnnotation;
}
set topAnnotation(v: string) {
this.data.topAnnotation = v;
}
get buttonColor(): pslGraphicData.PslElementColor {
return this.data.buttonColor;
}

View File

@ -26,18 +26,6 @@ export class PslKeyData extends GraphicDataBase implements IPslKeyData {
set code(v: string) {
this.data.code = v;
}
get topAnnotation(): string {
return this.data.topAnnotation;
}
set topAnnotation(v: string) {
this.data.topAnnotation = v;
}
get rightAnnotation(): string {
return this.data.rightAnnotation;
}
set rightAnnotation(v: string) {
this.data.rightAnnotation = v;
}
clone(): PslKeyData {
return new PslKeyData(this.data.cloneMessage());
}

View File

@ -26,12 +26,6 @@ export class PslLightData extends GraphicDataBase implements IPslLightData {
set code(v: string) {
this.data.code = v;
}
get topAnnotation(): string {
return this.data.topAnnotation;
}
set topAnnotation(v: string) {
this.data.topAnnotation = v;
}
get lightColor(): pslGraphicData.PslElementColor {
return this.data.lightColor;
}

View File

@ -3,7 +3,6 @@ import {
GraphicState,
JlGraphic,
JlGraphicTemplate,
VectorText,
} from 'src/jl-graphic';
import Psl_Button_Assets from './psl-button-spritesheet.png';
import Psl_Button_JSON from './psl-button-data.json';
@ -19,18 +18,10 @@ interface PslButtonTextures {
export interface IPslButtonData extends GraphicData {
get code(): string;
set code(v: string);
get topAnnotation(): string;
set topAnnotation(v: string);
get buttonColor(): pslGraphicData.PslElementColor;
set buttonColor(v: pslGraphicData.PslElementColor);
}
const pslConst = {
annotationFontSize: 14,
annotationColor: '0XFFFFFF',
topAnnotationOffset: -40,
};
export interface IPslButtonState extends GraphicState {
get state(): number;
set state(v: number);
@ -39,7 +30,6 @@ export interface IPslButtonState extends GraphicState {
export class PslButton extends JlGraphic {
static Type = 'PslButton';
_pslButton: Sprite;
topAnnotation: VectorText;
pslButtonTextures: PslButtonTextures;
__state = 0;
@ -47,12 +37,9 @@ export class PslButton extends JlGraphic {
super(PslButton.Type);
this.pslButtonTextures = pslButtonTextures;
this._pslButton = new Sprite();
this.topAnnotation = new VectorText();
this.topAnnotation.name = 'topAnnotation';
this._pslButton.texture = this.pslButtonTextures.redBtn;
this._pslButton.anchor.set(0.5);
this.addChild(this._pslButton);
this.addChild(this.topAnnotation);
}
get datas(): IPslButtonData {
return this.getDatas<IPslButtonData>();
@ -64,23 +51,6 @@ export class PslButton extends JlGraphic {
} else {
this._pslButton.texture = this.pslButtonTextures.redBtn;
}
if (this.datas.topAnnotation) {
this.topAnnotation.text = this.datas.topAnnotation || '';
this.topAnnotation.style.fill = pslConst.annotationColor;
this.topAnnotation.setVectorFontSize(pslConst.annotationFontSize);
this.topAnnotation.anchor.set(0.5);
const taTransform = this.datas.childTransforms?.find(
(item) => item.name === this.topAnnotation.name
);
if (taTransform) {
const position = taTransform?.transform.position;
const rotation = taTransform?.transform?.rotation;
this.topAnnotation.position.set(position?.x, position?.y);
this.topAnnotation.rotation = rotation || 0;
}
} else {
this.topAnnotation.position.set(0, pslConst.topAnnotationOffset);
}
}
}

View File

@ -133,22 +133,12 @@ export class PslButtonInteraction extends GraphicInteractionPlugin<PslButton> {
g.scalable = true;
g.rotatable = true;
g.on('transformstart', this.transformstart, this);
g.topAnnotation.draggable = true;
g.topAnnotation.selectable = true;
g.topAnnotation.rotatable = true;
g.topAnnotation.transformSave = true;
g.topAnnotation.eventMode = 'static';
}
unbind(g: PslButton): void {
g.eventMode = 'none';
g.scalable = false;
g.rotatable = false;
g.off('transformstart', this.transformstart, this);
g.topAnnotation.draggable = false;
g.topAnnotation.selectable = false;
g.topAnnotation.rotatable = false;
g.topAnnotation.transformSave = false;
g.topAnnotation.eventMode = 'none';
}
transformstart(e: GraphicTransformEvent) {
const target = e.target as DisplayObject;

View File

@ -3,7 +3,6 @@ import {
GraphicState,
JlGraphic,
JlGraphicTemplate,
VectorText,
} from 'src/jl-graphic';
import Psl_Key_Assets from './psl-key-spritesheet.png';
import Psl_Key_JSON from './psl-key-data.json';
@ -17,19 +16,8 @@ interface PslKeyTextures {
export interface IPslKeyData extends GraphicData {
get code(): string;
set code(v: string);
get topAnnotation(): string;
set topAnnotation(v: string);
get rightAnnotation(): string;
set rightAnnotation(v: string);
}
const pslConst = {
annotationFontSize: 14,
annotationColor: '0XFFFFFF',
topAnnotationOffset: -40,
rightAnnotationOffset: 60,
};
export interface IPslKeyState extends GraphicState {
get state(): number;
set state(v: number);
@ -38,8 +26,6 @@ export interface IPslKeyState extends GraphicState {
export class PslKey extends JlGraphic {
static Type = 'PslKey';
_pslKey: Sprite;
topAnnotation: VectorText;
rightAnnotation: VectorText;
pslkeyTextures: PslKeyTextures;
__state = 0;
@ -47,15 +33,9 @@ export class PslKey extends JlGraphic {
super(PslKey.Type);
this.pslkeyTextures = pslkeyTextures;
this._pslKey = new Sprite();
this.topAnnotation = new VectorText();
this.rightAnnotation = new VectorText();
this.topAnnotation.name = 'topAnnotation';
this.rightAnnotation.name = 'rightAnnotation';
this._pslKey.texture = this.pslkeyTextures.pslKey;
this._pslKey.anchor.set(0.5);
this.addChild(this._pslKey);
this.addChild(this.topAnnotation);
this.addChild(this.rightAnnotation);
}
get datas(): IPslKeyData {
return this.getDatas<IPslKeyData>();
@ -63,40 +43,6 @@ export class PslKey extends JlGraphic {
doRepaint(): void {
this._pslKey.rotation = 0;
this._pslKey.texture = this.pslkeyTextures.pslKey;
if (this.datas.topAnnotation) {
this.topAnnotation.text = this.datas.topAnnotation || '';
this.topAnnotation.style.fill = pslConst.annotationColor;
this.topAnnotation.setVectorFontSize(pslConst.annotationFontSize);
this.topAnnotation.anchor.set(0.5);
const taTransform = this.datas.childTransforms?.find(
(item) => item.name === this.topAnnotation.name
);
if (taTransform) {
const position = taTransform?.transform.position;
const rotation = taTransform?.transform?.rotation;
this.topAnnotation.position.set(position?.x, position?.y);
this.topAnnotation.rotation = rotation || 0;
}
} else {
this.topAnnotation.position.set(0, pslConst.topAnnotationOffset);
}
if (this.datas.rightAnnotation) {
this.rightAnnotation.text = this.datas.rightAnnotation || '';
this.rightAnnotation.style.fill = pslConst.annotationColor;
this.rightAnnotation.setVectorFontSize(pslConst.annotationFontSize);
this.rightAnnotation.anchor.set(0.5);
const taTransform = this.datas.childTransforms?.find(
(item) => item.name === this.rightAnnotation.name
);
if (taTransform) {
const position = taTransform?.transform.position;
const rotation = taTransform?.transform?.rotation;
this.rightAnnotation.position.set(position?.x, position?.y);
this.rightAnnotation.rotation = rotation || 0;
}
} else {
this.rightAnnotation.position.set(pslConst.rightAnnotationOffset, 0);
}
}
}

View File

@ -126,32 +126,12 @@ export class PslKeyInteraction extends GraphicInteractionPlugin<PslKey> {
g.scalable = true;
g.rotatable = true;
g.on('transformstart', this.transformstart, this);
g.topAnnotation.draggable = true;
g.topAnnotation.selectable = true;
g.topAnnotation.rotatable = true;
g.topAnnotation.transformSave = true;
g.topAnnotation.eventMode = 'static';
g.rightAnnotation.draggable = true;
g.rightAnnotation.selectable = true;
g.rightAnnotation.rotatable = true;
g.rightAnnotation.transformSave = true;
g.rightAnnotation.eventMode = 'static';
}
unbind(g: PslKey): void {
g.eventMode = 'none';
g.scalable = false;
g.rotatable = false;
g.off('transformstart', this.transformstart, this);
g.topAnnotation.draggable = false;
g.topAnnotation.selectable = false;
g.topAnnotation.rotatable = false;
g.topAnnotation.transformSave = false;
g.topAnnotation.eventMode = 'none';
g.rightAnnotation.draggable = false;
g.rightAnnotation.selectable = false;
g.rightAnnotation.rotatable = false;
g.rightAnnotation.transformSave = false;
g.rightAnnotation.eventMode = 'none';
}
transformstart(e: GraphicTransformEvent) {
const target = e.target as DisplayObject;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 42 KiB

After

Width:  |  Height:  |  Size: 40 KiB

View File

@ -3,7 +3,6 @@ import {
GraphicState,
JlGraphic,
JlGraphicTemplate,
VectorText,
} from 'src/jl-graphic';
import Psl_Light_Assets from './psl-light-spritesheet.png';
import Psl_Light_JSON from './psl-light-data.json';
@ -23,18 +22,10 @@ interface PslLightTextures {
export interface IPslLightData extends GraphicData {
get code(): string;
set code(v: string);
get topAnnotation(): string;
set topAnnotation(v: string);
get lightColor(): pslGraphicData.PslElementColor;
set lightColor(v: pslGraphicData.PslElementColor);
}
const pslConst = {
annotationFontSize: 14,
annotationColor: '0XFFFFFF',
topAnnotationOffset: -40,
};
export interface IPslLightState extends GraphicState {
get state(): number;
set state(v: number);
@ -43,7 +34,6 @@ export interface IPslLightState extends GraphicState {
export class PslLight extends JlGraphic {
static Type = 'PslLight';
_pslLight: Sprite;
topAnnotation: VectorText;
pslLightTextures: PslLightTextures;
__state = 0;
@ -51,12 +41,9 @@ export class PslLight extends JlGraphic {
super(PslLight.Type);
this.pslLightTextures = pslLightTextures;
this._pslLight = new Sprite();
this.topAnnotation = new VectorText();
this.topAnnotation.name = 'topAnnotation';
this._pslLight.texture = this.pslLightTextures.redOff;
this._pslLight.anchor.set(0.5);
this.addChild(this._pslLight);
this.addChild(this.topAnnotation);
}
get datas(): IPslLightData {
return this.getDatas<IPslLightData>();
@ -70,23 +57,6 @@ export class PslLight extends JlGraphic {
} else {
this._pslLight.texture = this.pslLightTextures.redOff;
}
if (this.datas.topAnnotation) {
this.topAnnotation.text = this.datas.topAnnotation || '';
this.topAnnotation.style.fill = pslConst.annotationColor;
this.topAnnotation.setVectorFontSize(pslConst.annotationFontSize);
this.topAnnotation.anchor.set(0.5);
const taTransform = this.datas.childTransforms?.find(
(item) => item.name === this.topAnnotation.name
);
if (taTransform) {
const position = taTransform.transform.position;
const rotation = taTransform.transform.rotation;
this.topAnnotation.position.set(position?.x, position?.y);
this.topAnnotation.rotation = rotation || 0;
}
} else {
this.topAnnotation.position.set(0, pslConst.topAnnotationOffset);
}
}
}

View File

@ -126,22 +126,12 @@ export class PslLightInteraction extends GraphicInteractionPlugin<PslLight> {
g.scalable = true;
g.rotatable = true;
g.on('transformstart', this.transformstart, this);
g.topAnnotation.draggable = true;
g.topAnnotation.selectable = true;
g.topAnnotation.rotatable = true;
g.topAnnotation.transformSave = true;
g.topAnnotation.eventMode = 'static';
}
unbind(g: PslLight): void {
g.eventMode = 'none';
g.scalable = false;
g.rotatable = false;
g.off('transformstart', this.transformstart, this);
g.topAnnotation.draggable = false;
g.topAnnotation.selectable = false;
g.topAnnotation.rotatable = false;
g.topAnnotation.transformSave = false;
g.topAnnotation.eventMode = 'none';
}
transformstart(e: GraphicTransformEvent) {
const target = e.target as DisplayObject;

View File

@ -155,7 +155,6 @@ export namespace pslGraphicData {
constructor(data?: any[] | {
common?: dependency_1.graphicData.CommonInfo;
code?: string;
topAnnotation?: string;
lightColor?: PslElementColor;
}) {
super();
@ -167,9 +166,6 @@ export namespace pslGraphicData {
if ("code" in data && data.code != undefined) {
this.code = data.code;
}
if ("topAnnotation" in data && data.topAnnotation != undefined) {
this.topAnnotation = data.topAnnotation;
}
if ("lightColor" in data && data.lightColor != undefined) {
this.lightColor = data.lightColor;
}
@ -190,12 +186,6 @@ export namespace pslGraphicData {
set code(value: string) {
pb_1.Message.setField(this, 2, value);
}
get topAnnotation() {
return pb_1.Message.getFieldWithDefault(this, 3, "") as string;
}
set topAnnotation(value: string) {
pb_1.Message.setField(this, 3, value);
}
get lightColor() {
return pb_1.Message.getFieldWithDefault(this, 4, PslElementColor.red) as PslElementColor;
}
@ -205,7 +195,6 @@ export namespace pslGraphicData {
static fromObject(data: {
common?: ReturnType<typeof dependency_1.graphicData.CommonInfo.prototype.toObject>;
code?: string;
topAnnotation?: string;
lightColor?: PslElementColor;
}): PslLight {
const message = new PslLight({});
@ -215,9 +204,6 @@ export namespace pslGraphicData {
if (data.code != null) {
message.code = data.code;
}
if (data.topAnnotation != null) {
message.topAnnotation = data.topAnnotation;
}
if (data.lightColor != null) {
message.lightColor = data.lightColor;
}
@ -227,7 +213,6 @@ export namespace pslGraphicData {
const data: {
common?: ReturnType<typeof dependency_1.graphicData.CommonInfo.prototype.toObject>;
code?: string;
topAnnotation?: string;
lightColor?: PslElementColor;
} = {};
if (this.common != null) {
@ -236,9 +221,6 @@ export namespace pslGraphicData {
if (this.code != null) {
data.code = this.code;
}
if (this.topAnnotation != null) {
data.topAnnotation = this.topAnnotation;
}
if (this.lightColor != null) {
data.lightColor = this.lightColor;
}
@ -252,8 +234,6 @@ export namespace pslGraphicData {
writer.writeMessage(1, this.common, () => this.common.serialize(writer));
if (this.code.length)
writer.writeString(2, this.code);
if (this.topAnnotation.length)
writer.writeString(3, this.topAnnotation);
if (this.lightColor != PslElementColor.red)
writer.writeEnum(4, this.lightColor);
if (!w)
@ -271,9 +251,6 @@ export namespace pslGraphicData {
case 2:
message.code = reader.readString();
break;
case 3:
message.topAnnotation = reader.readString();
break;
case 4:
message.lightColor = reader.readEnum();
break;
@ -294,7 +271,6 @@ export namespace pslGraphicData {
constructor(data?: any[] | {
common?: dependency_1.graphicData.CommonInfo;
code?: string;
topAnnotation?: string;
buttonColor?: PslElementColor;
}) {
super();
@ -306,9 +282,6 @@ export namespace pslGraphicData {
if ("code" in data && data.code != undefined) {
this.code = data.code;
}
if ("topAnnotation" in data && data.topAnnotation != undefined) {
this.topAnnotation = data.topAnnotation;
}
if ("buttonColor" in data && data.buttonColor != undefined) {
this.buttonColor = data.buttonColor;
}
@ -329,12 +302,6 @@ export namespace pslGraphicData {
set code(value: string) {
pb_1.Message.setField(this, 2, value);
}
get topAnnotation() {
return pb_1.Message.getFieldWithDefault(this, 3, "") as string;
}
set topAnnotation(value: string) {
pb_1.Message.setField(this, 3, value);
}
get buttonColor() {
return pb_1.Message.getFieldWithDefault(this, 4, PslElementColor.red) as PslElementColor;
}
@ -344,7 +311,6 @@ export namespace pslGraphicData {
static fromObject(data: {
common?: ReturnType<typeof dependency_1.graphicData.CommonInfo.prototype.toObject>;
code?: string;
topAnnotation?: string;
buttonColor?: PslElementColor;
}): PslButton {
const message = new PslButton({});
@ -354,9 +320,6 @@ export namespace pslGraphicData {
if (data.code != null) {
message.code = data.code;
}
if (data.topAnnotation != null) {
message.topAnnotation = data.topAnnotation;
}
if (data.buttonColor != null) {
message.buttonColor = data.buttonColor;
}
@ -366,7 +329,6 @@ export namespace pslGraphicData {
const data: {
common?: ReturnType<typeof dependency_1.graphicData.CommonInfo.prototype.toObject>;
code?: string;
topAnnotation?: string;
buttonColor?: PslElementColor;
} = {};
if (this.common != null) {
@ -375,9 +337,6 @@ export namespace pslGraphicData {
if (this.code != null) {
data.code = this.code;
}
if (this.topAnnotation != null) {
data.topAnnotation = this.topAnnotation;
}
if (this.buttonColor != null) {
data.buttonColor = this.buttonColor;
}
@ -391,8 +350,6 @@ export namespace pslGraphicData {
writer.writeMessage(1, this.common, () => this.common.serialize(writer));
if (this.code.length)
writer.writeString(2, this.code);
if (this.topAnnotation.length)
writer.writeString(3, this.topAnnotation);
if (this.buttonColor != PslElementColor.red)
writer.writeEnum(4, this.buttonColor);
if (!w)
@ -410,9 +367,6 @@ export namespace pslGraphicData {
case 2:
message.code = reader.readString();
break;
case 3:
message.topAnnotation = reader.readString();
break;
case 4:
message.buttonColor = reader.readEnum();
break;
@ -433,8 +387,6 @@ export namespace pslGraphicData {
constructor(data?: any[] | {
common?: dependency_1.graphicData.CommonInfo;
code?: string;
topAnnotation?: string;
rightAnnotation?: string;
}) {
super();
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls);
@ -445,12 +397,6 @@ export namespace pslGraphicData {
if ("code" in data && data.code != undefined) {
this.code = data.code;
}
if ("topAnnotation" in data && data.topAnnotation != undefined) {
this.topAnnotation = data.topAnnotation;
}
if ("rightAnnotation" in data && data.rightAnnotation != undefined) {
this.rightAnnotation = data.rightAnnotation;
}
}
}
get common() {
@ -468,23 +414,9 @@ export namespace pslGraphicData {
set code(value: string) {
pb_1.Message.setField(this, 2, value);
}
get topAnnotation() {
return pb_1.Message.getFieldWithDefault(this, 3, "") as string;
}
set topAnnotation(value: string) {
pb_1.Message.setField(this, 3, value);
}
get rightAnnotation() {
return pb_1.Message.getFieldWithDefault(this, 4, "") as string;
}
set rightAnnotation(value: string) {
pb_1.Message.setField(this, 4, value);
}
static fromObject(data: {
common?: ReturnType<typeof dependency_1.graphicData.CommonInfo.prototype.toObject>;
code?: string;
topAnnotation?: string;
rightAnnotation?: string;
}): PslKey {
const message = new PslKey({});
if (data.common != null) {
@ -493,20 +425,12 @@ export namespace pslGraphicData {
if (data.code != null) {
message.code = data.code;
}
if (data.topAnnotation != null) {
message.topAnnotation = data.topAnnotation;
}
if (data.rightAnnotation != null) {
message.rightAnnotation = data.rightAnnotation;
}
return message;
}
toObject() {
const data: {
common?: ReturnType<typeof dependency_1.graphicData.CommonInfo.prototype.toObject>;
code?: string;
topAnnotation?: string;
rightAnnotation?: string;
} = {};
if (this.common != null) {
data.common = this.common.toObject();
@ -514,12 +438,6 @@ export namespace pslGraphicData {
if (this.code != null) {
data.code = this.code;
}
if (this.topAnnotation != null) {
data.topAnnotation = this.topAnnotation;
}
if (this.rightAnnotation != null) {
data.rightAnnotation = this.rightAnnotation;
}
return data;
}
serialize(): Uint8Array;
@ -530,10 +448,6 @@ export namespace pslGraphicData {
writer.writeMessage(1, this.common, () => this.common.serialize(writer));
if (this.code.length)
writer.writeString(2, this.code);
if (this.topAnnotation.length)
writer.writeString(3, this.topAnnotation);
if (this.rightAnnotation.length)
writer.writeString(4, this.rightAnnotation);
if (!w)
return writer.getResultBuffer();
}
@ -549,12 +463,6 @@ export namespace pslGraphicData {
case 2:
message.code = reader.readString();
break;
case 3:
message.topAnnotation = reader.readString();
break;
case 4:
message.rightAnnotation = reader.readString();
break;
default: reader.skipField();
}
}