|
|
|
@ -13,6 +13,8 @@ import { PromptResult, PromptStatus } from './PromptResult';
|
|
|
|
|
import { FixIndex } from '../Common/Utils';
|
|
|
|
|
import { KeyWordContextMenu } from '../UI/Components/ContextMenu/KeyWordContextMenu';
|
|
|
|
|
|
|
|
|
|
const MENU_PADDING = 20;
|
|
|
|
|
const MENU_ITEM_HEIGHT = 30;
|
|
|
|
|
/**
|
|
|
|
|
* 指定用户拾取关键字的服务.
|
|
|
|
|
*
|
|
|
|
@ -68,8 +70,13 @@ export class GetKeyWordsServices implements EditorService
|
|
|
|
|
//更新上下文菜单的位置
|
|
|
|
|
private UpdateContextMenuPosition()
|
|
|
|
|
{
|
|
|
|
|
this.mousePositionX = this.ed.m_MouseCtrl.m_CurMousePointVCS.x;
|
|
|
|
|
this.mousePositionY = this.ed.m_MouseCtrl.m_CurMousePointVCS.y;
|
|
|
|
|
let menuHeight = this.keywordList.length * MENU_ITEM_HEIGHT + MENU_PADDING;
|
|
|
|
|
|
|
|
|
|
if (this.ed.m_MouseCtrl.m_CurMousePointClient.y > window.innerHeight - menuHeight)
|
|
|
|
|
this.mousePositionY = this.ed.m_MouseCtrl.m_CurMousePointClient.y - menuHeight;
|
|
|
|
|
else
|
|
|
|
|
this.mousePositionY = this.ed.m_MouseCtrl.m_CurMousePointClient.y;
|
|
|
|
|
this.mousePositionX = this.ed.m_MouseCtrl.m_CurMousePointClient.x;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Start(prompt: GetKeyWordPrommpt): Promise<PromptResult>
|
|
|
|
@ -86,11 +93,11 @@ export class GetKeyWordsServices implements EditorService
|
|
|
|
|
//默认所有的key为大写
|
|
|
|
|
prompt.KeyWordList.forEach(k => k.key = k.key.toUpperCase());
|
|
|
|
|
//初始化状态
|
|
|
|
|
this.keywordList = prompt.KeyWordList;
|
|
|
|
|
this.UpdateContextMenuPosition();
|
|
|
|
|
this.selectIndex = 0;
|
|
|
|
|
this.ed.m_InputState |= InputState.GetKeyWord;
|
|
|
|
|
this.IsReady = true;
|
|
|
|
|
this.keywordList = prompt.KeyWordList;
|
|
|
|
|
this.prompt = prompt.Msg;
|
|
|
|
|
this.InitHandleInput(prompt);
|
|
|
|
|
//初始化键盘输入
|
|
|
|
|