修正文本编辑和文本创建时撤销错误的问题

pull/220/head
ChenX 6 years ago
parent 64756ed9a8
commit 529930efbb

@ -31,8 +31,9 @@ export class DrawText implements Command
});
if (hRes.Status !== PromptStatus.Cancel && hRes.Value !== undefined)
{
let text = TextArea.GetInstance();
let text = TextArea.GetInstance() as TextArea;
text.StartDrawText(startPoint, height, hRes.Value, "");
await text.Wait();
}
}
}

@ -3,7 +3,6 @@ import { app } from '../../ApplicationServices/Application';
import { KeyBoard } from '../../Common/KeyEnum';
import { Singleton } from '../../Common/Singleton';
import { GetEntity } from '../../Common/Utils';
import { commandMachine } from '../../Editor/CommandMachine';
import { DownPanelStore } from '../../UI/Store/DownPanelStore';
import { FontLoader } from './FontLoader';
import { Text } from './Text';
@ -37,8 +36,6 @@ export class TextArea extends Singleton
}
StartDrawText(position: Vector3, height: number, rotate: number, str: string)
{
commandMachine.CommandStart("TextDraw");
document.getElementById('Webgl').parentNode.appendChild(this.m_AreaContiner);
this.RegisterEvent();
this.m_TextPosition = position;
@ -49,8 +46,6 @@ export class TextArea extends Singleton
}
StartEditorText(textObj)
{
commandMachine.CommandStart("EditText");
let text = GetEntity(textObj) as Text;
if (text)
{
@ -197,6 +192,17 @@ export class TextArea extends Singleton
app.m_Editor.UpdateScreen();
commandMachine.CommandEnd();
this.waitPromis.forEach(f => f());
this.waitPromis.length = 0;
}
private waitPromis: Function[] = [];
async Wait()
{
let promis = new Promise((res, rej) =>
{
this.waitPromis.push(res);
});
return promis;
}
}

@ -91,8 +91,11 @@ export class DbClickManager extends Singleton
}
else if (pickEnt instanceof Text)
{
let textarea = TextArea.GetInstance();
let textarea = TextArea.GetInstance() as TextArea;
commandMachine.CommandStart("EditText");
textarea.StartEditorText(pickObj);
await textarea.Wait();
commandMachine.CommandEnd();
}
else if (pickEnt instanceof Board)
{

Loading…
Cancel
Save