修复:fix #I4LX55 模态窗体关闭时,程序状态错误的认为模态还在进行中导致的交互错误

pull/1760/MERGE
ChenX 3 years ago
parent 6c2851dc38
commit ef76fbfbe1

@ -59,15 +59,16 @@ export class CommandPanel extends React.Component<{}, CommandPanelState>
if (last && this.scrollCard !== null)
this.scrollCard.scrollTop = last;
}
private _RemoveRejF: Function;
componentDidMount()
{
this.UseLastScrollTop();
app.Editor.MaskManage.events.push(
end(app.Editor.MaskManage, app.Editor.MaskManage.OnFocusEvent, () =>
{
app.Editor.ModalManage.Destory();
})
);
this._RemoveRejF = end(app.Editor.MaskManage, app.Editor.MaskManage.OnFocusEvent, () =>
{
app.Editor.ModalManage.Destory();
});
const Focus = async () =>
{
@ -94,6 +95,8 @@ export class CommandPanel extends React.Component<{}, CommandPanelState>
{
//上传数据
CommandServer.GetInstance().Upload();
if (this._RemoveRejF) this._RemoveRejF();
}
render()
{

@ -19,6 +19,7 @@ export class CADModal
static ModalOldPosition: { left: string, top: string; } = { left: "0", top: "0" };
container: HTMLElement;
IsModal: Boolean = false;
IsDestoryed: Boolean = false;
rndDiv: HTMLElement;
dragHandleEl: HTMLElement;
dhTopEnd: number;
@ -366,7 +367,7 @@ export class CADModal
}
Minimize()
{
app.Editor.MaskManage.m_Masking.style.display = "none";
app.Editor.MaskManage._Masking.style.display = "none";
if (this.container.children.length > 0)
{
if (this.canMinimize)
@ -458,6 +459,7 @@ export class CADModal
}
Destory()
{
this.IsDestoryed = true;
this.container.removeEventListener('focus', this.onFocus);
ReactDOM.unmountComponentAtNode(this.container);
this.container.remove();

@ -5,14 +5,12 @@ import { ZINDEX } from "../../../Common/ZIndex";
*/
export class MaskManage
{
public m_Masking: HTMLElement;
events: Function[] = [];
public _Masking: HTMLElement;
constructor()
{
//蒙版层
this.m_Masking = document.createElement("div");
this.m_Masking.style.cssText = `
this._Masking = document.createElement("div");
this._Masking.style.cssText = `
display:none;
position: fixed;
top: 0;
@ -24,23 +22,23 @@ export class MaskManage
zIndex:0;
background: #000;
opacity: 0.3;`;
this.m_Masking.tabIndex = -1;
document.body.appendChild(this.m_Masking);
this._Masking.tabIndex = -1;
document.body.appendChild(this._Masking);
this.RegisterEvent();
}
get IsShow()
{
return this.m_Masking.style.display === "block";
return this._Masking.style.display === "block";
}
private RegisterEvent()
{
//捕获蒙版的事件
this.m_Masking.addEventListener('keydown', e => e.stopPropagation());
this.m_Masking.addEventListener('click', e => e.stopPropagation());
this.m_Masking.addEventListener('focus', () => this.OnFocusEvent());
this._Masking.addEventListener('keydown', e => e.stopPropagation());
this._Masking.addEventListener('click', e => e.stopPropagation());
this._Masking.addEventListener('focus', () => this.OnFocusEvent());
}
OnFocusEvent()
@ -55,20 +53,18 @@ export class MaskManage
if (isLow && this.IsShow)
return;
this.m_Masking.style.display = "block";
this.m_Masking.style.zIndex = isLow ? ZINDEX.Common : ZINDEX.HighMasking;
this._Masking.style.display = "block";
this._Masking.style.zIndex = isLow ? ZINDEX.Common : ZINDEX.HighMasking;
if (isTransparent)
{
this.m_Masking.style.opacity = "0";
this._Masking.style.opacity = "0";
}
}
Clear()
{
this.m_Masking.style.display = "none";
this.m_Masking.style.opacity = "0.3";
this.m_Masking.style.zIndex = "0";
this.events.forEach(f => f());
this.events.length = 0;
this._Masking.style.display = "none";
this._Masking.style.opacity = "0.3";
this._Masking.style.zIndex = "0";
}
}

@ -64,9 +64,11 @@ export class ModalManage
this.RegisterEvent();
}
//模态框进行中
get IsModal()
{
return this.CurrentModal?.IsModal;
return this.CurrentModal?.IsModal && !this.CurrentModal?.IsDestoryed;
}
get CurrentModal()
{

@ -27,7 +27,7 @@ export class RightPanelStore
modeling2Store = new Modeling2Store();
modeling3Store = new Modeling2Store();
knifeMap = new Map<string, (IOptionProps & { props?: IKnifeProps; })>();
constructor()
private constructor()
{
let selectCtrl = app.Editor.SelectCtrl;
begin(selectCtrl, selectCtrl.AddSelect, (ss: SelectSetBase) =>

Loading…
Cancel
Save