|
|
|
@ -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";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|