!1107 修复:已知模态框无法关闭的问题

pull/1107/MERGE
ZoeLeeFZ 4 years ago committed by ChenX
parent b5ed537f2f
commit ad67d8abd5

@ -87,9 +87,11 @@ export class DrillTypeCom extends React.Component<{ store: DrillStore; }, { type
<Popover
position={Position.LEFT}
onClosed={() => this.setState({ typeName: "" })}
usePortal={false}
content={
<Card>
<input type="text"
style={{ height: 30 }}
className={Classes.INPUT}
value={this.state.typeName}
onChange={e => this.setState({ typeName: e.target.value })}
@ -97,7 +99,8 @@ export class DrillTypeCom extends React.Component<{ store: DrillStore; }, { type
<Button
text="确定"
className={Classes.POPOVER_DISMISS}
style={{ marginLeft: 20 }}
style={{ margin: 0 }}
intent={Intent.SUCCESS}
onClick={this.addDrillType}
/>
</Card>

@ -17,6 +17,7 @@ import { ModalPosition } from './ModalInterface';
import { ExtrudeHole } from '../../../DatabaseServices/3DSolid/ExtrudeHole';
import { appCache } from '../../../Common/AppCache';
import { StoreageKeys } from '../../../Common/StoreageKeys';
import { CommandWrap } from '../../../Editor/CommandMachine';
export interface IDrillTempListProps
{
@ -152,7 +153,7 @@ export class DrillingTemplateList extends React.Component<IDrillTempListProps, {
private startEditorTopline = async (temp: { module_id: string; }) =>
{
TempEditor.Start();
app.Editor.ModalManage.Destory();
app.Editor.ModalManage.DestoryAll();
let data = await PostJson(TemplateUrls.detail, { module_id: temp.module_id });
@ -160,21 +161,27 @@ export class DrillingTemplateList extends React.Component<IDrillTempListProps, {
{
let files = JSON.parse(inflate(data.modules.file));
let ens = files.map(ExtrudeDrillFileIn) as ExtrudeSolid[];
ens.forEach(e => app.Database.ModelSpace.Append(e));
this._cameraFiler = new CADFiler;
app.Viewer.CameraCtrl.WriteFile(this._cameraFiler);
app.Viewer.ZoomAll();
AppToaster.show({
message: this.renderToasterMessage(),
intent: Intent.PRIMARY,
timeout: 0,
onDismiss: this.exitEditor
});
await CommandWrap(() =>
{
ens.forEach(e => app.Database.ModelSpace.Append(e));
this._cameraFiler = new CADFiler;
app.Viewer.CameraCtrl.WriteFile(this._cameraFiler);
app.Viewer.ZoomAll();
AppToaster.show({
message: this.renderToasterMessage(),
intent: Intent.PRIMARY,
timeout: 0,
onDismiss: this.exitEditor
});
}, "编辑排钻模板");
}
};
private exitEditor = () =>
private exitEditor = async () =>
{
app.Editor.ModalManage.DestoryAll();
await app.Editor.ModalManage.EndExecingCmd();
if (!this._cameraFiler) return;
app.Viewer.CameraCtrl.ReadFile(this._cameraFiler);
TempEditor.End();

@ -42,6 +42,8 @@ export class ModalManage
private _currentFocusKey = "";
private _List: Map<string, CADModal> = new Map();
private _Show = true;
private IsCtrlDown = false;
private IsAltDown = false;
constructor(private ed: Editor)
{
@ -89,7 +91,11 @@ export class ModalManage
}
}
else
{
this.IsCtrlDown = false;
this.IsAltDown = false;
this.MinAll();
}
});
}
onFocus(e: FocusEvent)
@ -126,12 +132,37 @@ export class ModalManage
if (e.ctrlKey)
e.preventDefault();
break;
case KeyBoard.KeyX:
if (this.IsAltDown)
{
e.preventDefault();
this.DestoryAll();
}
break;
case KeyBoard.Control:
this.IsCtrlDown = true;
break;
case KeyBoard.Alt:
this.IsAltDown = true;
break;
}
e.stopPropagation();
this.stopKeyDownEvent = false;
}
onKeyUp(e: KeyboardEvent)
{
switch (e.keyCode)
{
case KeyBoard.Control:
this.IsCtrlDown = false;
break;
case KeyBoard.Alt:
this.IsAltDown = false;
break;
default:
break;
}
e.stopPropagation();
}
RenderModeless<T extends AnyObject>(Component: React.ComponentType<T>, props?: T, option: IModalProps = {})
{
@ -152,7 +183,14 @@ export class ModalManage
RenderModal<T extends AnyObject>(Component: React.ComponentType<T>, props?: T, option: IModalProps = {})
{
for (let [k, modal] of this._List)
{
if (modal.IsModal)
{
console.error("未知情况");
continue;
}
modal.IsLock = true;
}
this.RenderModeless(Component, props, { ...option, isModal: true });
}
async EndExecingCmd()
@ -267,6 +305,7 @@ export class ModalManage
{
modal.Destory();
}
app.Editor.MaskManage.Clear();
this._List.clear();
if (this.m_PromisRes)
this.m_PromisRes({ Status: ModalState.Cancel });

@ -11,7 +11,7 @@ import { ToplineUrls } from '../../../Common/HostUrl';
import { inflate, toplineFileIn, getPolylineSVG, deflate } from '../../../Common/SerializeMaterial';
import { CADFiler } from '../../../DatabaseServices/CADFiler';
import { ZoomToEntity } from '../../Store/RightPanelStore/BoardEdgesEditor';
import { commandMachine } from '../../../Editor/CommandMachine';
import { CommandWrap } from '../../../Editor/CommandMachine';
import { AppToaster } from '../Toaster';
import { TopllineManage } from './ToplineManage';
import { ModalPosition } from '../Modal/ModalInterface';
@ -52,8 +52,10 @@ export class ToplineList extends React.Component<IToplineListProps, { isContextM
this.showContextMenu(e, tpline);
}
};
private exitEditor = () =>
private exitEditor = async () =>
{
app.Editor.ModalManage.DestoryAll();
await app.Editor.ModalManage.EndExecingCmd();
if (!this._cameraFiler) return;
app.Viewer.CameraCtrl.ReadFile(this._cameraFiler);
TempEditor.End();
@ -79,7 +81,7 @@ export class ToplineList extends React.Component<IToplineListProps, { isContextM
private startEditorTopline = async (tpline) =>
{
TempEditor.Start();
app.Editor.ModalManage.Destory();
app.Editor.ModalManage.DestoryAll();
let data = await PostJson(ToplineUrls.detail, { topline_id: tpline.topline_id });
@ -87,18 +89,20 @@ export class ToplineList extends React.Component<IToplineListProps, { isContextM
{
let file = inflate(data.toplines.file);
let pl = toplineFileIn(file);
app.Database.ModelSpace.Append(pl);
app.Database.hm.lockIndex++;//禁止初始化动作被撤销
this._cameraFiler = new CADFiler;
app.Viewer.CameraCtrl.WriteFile(this._cameraFiler);
ZoomToEntity(pl);
commandMachine.ExecCommand('fs');
AppToaster.show({
message: this.renderToasterMessage(),
intent: Intent.PRIMARY,
timeout: 0,
onDismiss: this.exitEditor
});
await CommandWrap(() =>
{
app.Database.ModelSpace.Append(pl);
app.Database.hm.lockIndex++;//禁止初始化动作被撤销
this._cameraFiler = new CADFiler;
app.Viewer.CameraCtrl.WriteFile(this._cameraFiler);
ZoomToEntity(pl);
AppToaster.show({
message: this.renderToasterMessage(),
intent: Intent.PRIMARY,
timeout: 0,
onDismiss: this.exitEditor
});
}, "编辑顶线");
}
};
private handleUpdateTopline = async () =>

Loading…
Cancel
Save