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