fix: 更新编辑器服务,确保非区域笔锁定状态为禁用编辑,并在设置状态时渲染更新
This commit is contained in:
parent
5f59225aed
commit
5d57a8924f
@ -275,6 +275,17 @@ export class EditorService extends Meta2d {
|
||||
*/
|
||||
public setState(editable?: boolean): void {
|
||||
this.lock(editable ? LockState.None : LockState.DisableEdit);
|
||||
this.data().pens.forEach((pen: MapPen) => {
|
||||
if (pen.name !== 'area') {
|
||||
if (pen.locked !== LockState.DisableEdit) {
|
||||
this.setValue(
|
||||
{ id: pen.id, locked: LockState.DisableEdit },
|
||||
{ render: false, history: false, doEvent: false },
|
||||
);
|
||||
}
|
||||
}
|
||||
});
|
||||
this.render();
|
||||
}
|
||||
|
||||
public override data(): SceneData {
|
||||
@ -641,6 +652,7 @@ export class EditorService extends Meta2d {
|
||||
tags: ['point'],
|
||||
label: `P${id}`,
|
||||
point: { type },
|
||||
locked: LockState.DisableEdit,
|
||||
};
|
||||
pen.x! -= pen.width! / 2;
|
||||
pen.y! -= pen.height! / 2;
|
||||
@ -721,7 +733,7 @@ export class EditorService extends Meta2d {
|
||||
const line = this.connectLine(p1, p2, undefined, undefined, false);
|
||||
id ||= line.id!;
|
||||
this.changePenId(line.id!, id);
|
||||
const pen: MapPen = { tags: ['route'], route: { type }, lineWidth: 1 };
|
||||
const pen: MapPen = { tags: ['route'], route: { type }, lineWidth: 1, locked: LockState.DisableEdit };
|
||||
this.setValue({ id, ...pen }, { render: false, history: false, doEvent: false });
|
||||
this.updateLineType(line, type);
|
||||
this.active(id);
|
||||
|
Loading…
x
Reference in New Issue
Block a user