站台和车站微调
This commit is contained in:
parent
ae471acea3
commit
241de95414
@ -69,6 +69,12 @@ enum showSelect {
|
|||||||
向左 = 'left',
|
向左 = 'left',
|
||||||
向右 = 'right',
|
向右 = 'right',
|
||||||
}
|
}
|
||||||
|
enum showSelectData {
|
||||||
|
true = '是',
|
||||||
|
false = '否',
|
||||||
|
left = '向左',
|
||||||
|
right = '向右',
|
||||||
|
}
|
||||||
|
|
||||||
drawStore.$subscribe;
|
drawStore.$subscribe;
|
||||||
watch(
|
watch(
|
||||||
@ -76,6 +82,10 @@ watch(
|
|||||||
(val) => {
|
(val) => {
|
||||||
if (val && val.type == Platform.Type) {
|
if (val && val.type == Platform.Type) {
|
||||||
platformModel.copyFrom(val.saveData() as PlatformData);
|
platformModel.copyFrom(val.saveData() as PlatformData);
|
||||||
|
hasDoor.value = (showSelectData as never)[platformModel.hasdoor + ''];
|
||||||
|
trainDirection.value = (showSelectData as never)[
|
||||||
|
platformModel.trainDirection
|
||||||
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@ -84,6 +94,10 @@ onMounted(() => {
|
|||||||
const platform = drawStore.selectedGraphic as Platform;
|
const platform = drawStore.selectedGraphic as Platform;
|
||||||
if (platform) {
|
if (platform) {
|
||||||
platformModel.copyFrom(platform.saveData());
|
platformModel.copyFrom(platform.saveData());
|
||||||
|
hasDoor.value = (showSelectData as never)[platformModel.hasdoor + ''];
|
||||||
|
trainDirection.value = (showSelectData as never)[
|
||||||
|
platformModel.trainDirection
|
||||||
|
];
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
@blur="onUpdate"
|
@blur="onUpdate"
|
||||||
label="字体大小"
|
label="字体大小"
|
||||||
lazy-rules
|
lazy-rules
|
||||||
:rules="[(val) => (val && val > 0) || '画布宽必须大于0']"
|
:rules="[(val) => (val && val > 0) || '字体大小必须大于0']"
|
||||||
/>
|
/>
|
||||||
<q-input
|
<q-input
|
||||||
outlined
|
outlined
|
||||||
|
@ -7,7 +7,9 @@ import {
|
|||||||
} from 'pixi.js';
|
} from 'pixi.js';
|
||||||
import {
|
import {
|
||||||
GraphicDrawAssistant,
|
GraphicDrawAssistant,
|
||||||
|
GraphicInteractionPlugin,
|
||||||
JlDrawApp,
|
JlDrawApp,
|
||||||
|
JlGraphic,
|
||||||
KeyListener,
|
KeyListener,
|
||||||
getRectangleCenter,
|
getRectangleCenter,
|
||||||
} from 'src/jlgraphic';
|
} from 'src/jlgraphic';
|
||||||
@ -46,6 +48,7 @@ export class PlatformDraw extends GraphicDrawAssistant<
|
|||||||
this.container.addChild(this.platformGraphic);
|
this.container.addChild(this.platformGraphic);
|
||||||
this.container.addChild(this.doorGraphic);
|
this.container.addChild(this.doorGraphic);
|
||||||
this.graphicTemplate.hasdoor = true;
|
this.graphicTemplate.hasdoor = true;
|
||||||
|
platformInteraction.init(app);
|
||||||
}
|
}
|
||||||
|
|
||||||
bind(): void {
|
bind(): void {
|
||||||
@ -103,7 +106,7 @@ export class PlatformDraw extends GraphicDrawAssistant<
|
|||||||
prepareData(data: IPlatformData): boolean {
|
prepareData(data: IPlatformData): boolean {
|
||||||
const template = this.graphicTemplate;
|
const template = this.graphicTemplate;
|
||||||
data.hasdoor = template.hasdoor;
|
data.hasdoor = template.hasdoor;
|
||||||
data.trainDirection=template.trainDirection;
|
data.trainDirection = template.trainDirection;
|
||||||
data.point = this.point;
|
data.point = this.point;
|
||||||
data.lineWidth = template.lineWidth;
|
data.lineWidth = template.lineWidth;
|
||||||
data.lineColor = template.lineColor;
|
data.lineColor = template.lineColor;
|
||||||
@ -113,3 +116,29 @@ export class PlatformDraw extends GraphicDrawAssistant<
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export class platformInteraction extends GraphicInteractionPlugin<Platform> {
|
||||||
|
static Name = 'platform_transform';
|
||||||
|
constructor(app: JlDrawApp) {
|
||||||
|
super(platformInteraction.Name, app);
|
||||||
|
}
|
||||||
|
static init(app: JlDrawApp) {
|
||||||
|
return new platformInteraction(app);
|
||||||
|
}
|
||||||
|
filter(...grahpics: JlGraphic[]): Platform[] | undefined {
|
||||||
|
return grahpics
|
||||||
|
.filter((g) => g.type === Platform.Type)
|
||||||
|
.map((g) => g as Platform);
|
||||||
|
}
|
||||||
|
bind(g: Platform): void {
|
||||||
|
g.eventMode = 'static';
|
||||||
|
g.cursor = 'pointer';
|
||||||
|
g.scalable = true;
|
||||||
|
g.rotatable = true;
|
||||||
|
}
|
||||||
|
unbind(g: Platform): void {
|
||||||
|
g.eventMode = 'none';
|
||||||
|
g.scalable = false;
|
||||||
|
g.rotatable = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
import { FederatedPointerEvent, Point } from 'pixi.js';
|
import { FederatedPointerEvent, Point } from 'pixi.js';
|
||||||
import {
|
import {
|
||||||
GraphicDrawAssistant,
|
GraphicDrawAssistant,
|
||||||
|
GraphicInteractionPlugin,
|
||||||
JlDrawApp,
|
JlDrawApp,
|
||||||
|
JlGraphic,
|
||||||
KeyListener,
|
KeyListener,
|
||||||
VectorText,
|
VectorText,
|
||||||
} from 'src/jlgraphic';
|
} from 'src/jlgraphic';
|
||||||
@ -32,6 +34,7 @@ export class StationDraw extends GraphicDrawAssistant<
|
|||||||
super(app, new StationTemplate(), createData, Station.Type, '车站Station');
|
super(app, new StationTemplate(), createData, Station.Type, '车站Station');
|
||||||
this.container.addChild(this.codeGraph);
|
this.container.addChild(this.codeGraph);
|
||||||
this.codeGraph.setVectorFontSize(22);
|
this.codeGraph.setVectorFontSize(22);
|
||||||
|
stationInteraction.init(app);
|
||||||
}
|
}
|
||||||
|
|
||||||
bind(): void {
|
bind(): void {
|
||||||
@ -71,3 +74,29 @@ export class StationDraw extends GraphicDrawAssistant<
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export class stationInteraction extends GraphicInteractionPlugin<Station> {
|
||||||
|
static Name = 'station_transform';
|
||||||
|
constructor(app: JlDrawApp) {
|
||||||
|
super(stationInteraction.Name, app);
|
||||||
|
}
|
||||||
|
static init(app: JlDrawApp) {
|
||||||
|
return new stationInteraction(app);
|
||||||
|
}
|
||||||
|
filter(...grahpics: JlGraphic[]): Station[] | undefined {
|
||||||
|
return grahpics
|
||||||
|
.filter((g) => g.type === Station.Type)
|
||||||
|
.map((g) => g as Station);
|
||||||
|
}
|
||||||
|
bind(g: Station): void {
|
||||||
|
g.eventMode = 'static';
|
||||||
|
g.cursor = 'pointer';
|
||||||
|
g.scalable = true;
|
||||||
|
g.rotatable = true;
|
||||||
|
}
|
||||||
|
unbind(g: Station): void {
|
||||||
|
g.eventMode = 'none';
|
||||||
|
g.scalable = false;
|
||||||
|
g.rotatable = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user