优化拖拽,优化灯光模态框

pull/93/head
Zoe 6 years ago
parent 7a4d916de0
commit 975240b586

@ -1,10 +1,11 @@
#modal{ #modal{
position: fixed; position: fixed;
z-index: 2; z-index: 10;
outline: none; outline: none;
} }
#modal .bp3-dialog{ #modal .bp3-dialog{
width: auto; margin: 0;
width: 100%;
} }
#lightModal h5{ #lightModal h5{
color: #CCCCCC; color: #CCCCCC;
@ -21,27 +22,43 @@
margin:10px 0; margin:10px 0;
text-align: right; text-align: right;
} }
#modal .bp3-dialog-body .twoCol>label{ #lightModal .bp3-dialog-body>.twoCol>label{
display: inline-block; display: inline-block;
width: 20%;
vertical-align: super; vertical-align: super;
text-align: left; text-align: left;
margin-right: 10px;
width: 30%;
} }
#modal .bp3-dialog-body .twoCol>input{ #lightModal .bp3-dialog-body ul>.twoCol>label{
display: inline-block;
vertical-align: super; vertical-align: super;
width: 75%; text-align: left;
margin-right: 10px;
}
#lightModal .bp3-dialog-body>.twoCol>input{
vertical-align: super;
width: 70%;
}
#lightModal .bp3-dialog-body>.twoCol ul input{
width: 80%;
}
#lightModal .bp3-dialog-body>.twoCol{
width: 14rem;
display: flex;
}
#lightModal .bp3-dialog-body .twoCol{
display: flex;
} }
#lightModal ul{ #lightModal ul{
display: inline-block; display: inline-block;
list-style: none; list-style: none;
padding-left: 0; padding-left: 0;
width: 75%; vertical-align: top;
width: 70%;
margin: 0; margin: 0;
} }
#lightModal li{ #lightModal li{
display: inline-block; display: inline-block;
width: 33.3333%
} }
// 输入框高度 // 输入框高度
@ -55,6 +72,7 @@
/* 板件input样式调整 */ /* 板件input样式调整 */
#boardModal .bp3-dialog-body .bp3-label{ #boardModal .bp3-dialog-body .bp3-label{
line-height: @inputHeight; line-height: @inputHeight;
margin-bottom: 0.5rem;
} }
#boardModal .bp3-dialog-body .bp3-label>span{ #boardModal .bp3-dialog-body .bp3-label>span{
display: inline-block; display: inline-block;
@ -227,7 +245,7 @@
//选择材质 //选择材质
#boardModal{ #boardModal{
.br-mat{ .br-mat{
margin-bottom: 15px; margin-bottom:0.5rem;
} }
.br-mat>div>label:last-child{ .br-mat>div>label:last-child{
margin-bottom: 0; margin-bottom: 0;

@ -128,10 +128,9 @@ export class ModalManage
{ {
let commandHeight = document.getElementsByClassName("lm_item lm_row")[0].clientHeight; let commandHeight = document.getElementsByClassName("lm_item lm_row")[0].clientHeight;
this.m_ModalContainer.style.left = `calc( 50% - ${this.m_ModalContainer.clientWidth / 2}px)`; this.m_ModalContainer.style.left = `calc( 50% - ${this.m_ModalContainer.clientWidth / 2}px)`;
this.m_ModalContainer.style.top = `calc( 50% - ${(this.m_ModalContainer.clientHeight + commandHeight - 40) / 2}px)`; this.m_ModalContainer.style.top = `calc( 50% - ${(this.m_ModalContainer.clientHeight) / 2}px)`;
} }
this.m_ModalContainer.style.width = "auto";
this.m_ModalContainer.focus(); this.m_ModalContainer.focus();
this.MoveModal(); this.MoveModal();
} }
@ -181,16 +180,11 @@ export class ModalManage
//鼠标在模态框的位置 //鼠标在模态框的位置
let modalX; let modalX;
let modalY; let modalY;
//命令栏高度
let commandHeight = document.getElementsByClassName("lm_item lm_row")[0].clientHeight;
//底部面板高度
let downHeight = document.getElementById("DownPanel").offsetHeight;
let topHeight = 40;
dragArea.onmousedown = (e) => dragArea.onmousedown = (e) =>
{ {
//底部边界 //底部边界
let maxBottom = window.innerHeight - commandHeight - modal.offsetHeight + downHeight; let maxBottom = window.innerHeight - modal.offsetHeight;
modalX = e.clientX - modal.offsetLeft; modalX = e.clientX - modal.offsetLeft;
modalY = e.clientY - modal.offsetTop; modalY = e.clientY - modal.offsetTop;
modal.style.cursor = "move"; modal.style.cursor = "move";
@ -202,13 +196,17 @@ export class ModalManage
(moveX > window.innerWidth - modal.offsetWidth) moveX = window.innerWidth - modal.offsetWidth; (moveX > window.innerWidth - modal.offsetWidth) moveX = window.innerWidth - modal.offsetWidth;
let moveY = e.clientY - modalY; let moveY = e.clientY - modalY;
if (moveY < topHeight) moveY = topHeight;
if (moveY < 0) moveY = 0;
else if (moveY > maxBottom) moveY = maxBottom; else if (moveY > maxBottom) moveY = maxBottom;
if (moveY > 0)
{
modal.style.top = moveY + "px";
modalY = e.clientY - modal.offsetTop;
}
modal.style.left = moveX + "px"; modal.style.left = moveX + "px";
modal.style.top = moveY + "px";
modalX = e.clientX - modal.offsetLeft; modalX = e.clientX - modal.offsetLeft;
modalY = e.clientY - modal.offsetTop;
} }
} }
document.onmouseup = (e) => document.onmouseup = (e) =>

Loading…
Cancel
Save