弹窗拖拽优化
This commit is contained in:
@ -10,16 +10,16 @@ export default function ChatHeader(props) {
|
||||
<div
|
||||
className={style.customer_service_content}
|
||||
id="chatHeader"
|
||||
onMouseOver={(e)=>{
|
||||
if(e.target.id=='chatHeader' || e.target.id=='chatHeaderTitle'|| e.target.id=='chatHeaderSologan' || e.target.id=='chatHeaderAvatar'){
|
||||
mouseOverHandle(e,props.chatUI)
|
||||
}
|
||||
}}
|
||||
onMouseMove={(e)=>{
|
||||
if(e.target.id=='chatHeader' || e.target.id=='chatHeaderTitle'|| e.target.id=='chatHeaderSologan'|| e.target.id=='chatHeaderAvatar'){
|
||||
mouseMoveHandle(e,props.chatUI)
|
||||
}
|
||||
}}
|
||||
// onMouseOver={(e)=>{
|
||||
// if(e.target.id=='chatHeader' || e.target.id=='chatHeaderTitle'|| e.target.id=='chatHeaderSologan' || e.target.id=='chatHeaderAvatar'){
|
||||
// mouseOverHandle(e,props.chatUI)
|
||||
// }
|
||||
// }}
|
||||
// onMouseMove={(e)=>{
|
||||
// if(e.target.id=='chatHeader' || e.target.id=='chatHeaderTitle'|| e.target.id=='chatHeaderSologan'|| e.target.id=='chatHeaderAvatar'){
|
||||
// mouseMoveHandle(e,props.chatUI)
|
||||
// }
|
||||
// }}
|
||||
onMouseDown={(e)=>{
|
||||
if(e.target.id=='chatHeader' || e.target.id=='chatHeaderTitle'|| e.target.id=='chatHeaderSologan'|| e.target.id=='chatHeaderAvatar'){
|
||||
mouseDrag(e,150,props.chatUI,null,null)
|
||||
|
@ -133,12 +133,12 @@ export function mouseOverHandle(e,chatUI){
|
||||
direction = 'top';
|
||||
}
|
||||
|
||||
if(clickBox.id=="chatHeader" ){
|
||||
e=e||event; //兼容ie和其他浏览器的写法
|
||||
if ((mouseDownY > clickBoxTop && mouseDownY < clickBoxBottom) || (mouseDownX > clickBoxLeft && mouseDownX < clickBoxRight)){
|
||||
direction = 'move';
|
||||
}
|
||||
}
|
||||
// if(clickBox.id=="chatHeader" ){
|
||||
// e=e||event; //兼容ie和其他浏览器的写法
|
||||
// if ((mouseDownY > clickBoxTop && mouseDownY < clickBoxBottom) || (mouseDownX > clickBoxLeft && mouseDownX < clickBoxRight)){
|
||||
// direction = 'move';
|
||||
// }
|
||||
// }
|
||||
|
||||
if(direction!=0){
|
||||
if(direction=="left" || direction=="right"){
|
||||
@ -148,8 +148,6 @@ export function mouseOverHandle(e,chatUI){
|
||||
}else{
|
||||
clickBox.style.cursor="auto"
|
||||
}
|
||||
}else if(direction == "move"){
|
||||
clickBox.style.cursor="auto"
|
||||
}else{
|
||||
clickBox.style.cursor="auto"
|
||||
}
|
||||
@ -175,20 +173,18 @@ export function mouseMoveHandle(e,chatUI){
|
||||
direction = 'top';
|
||||
}
|
||||
}
|
||||
if(clickBox.id=="chatHeader" ){
|
||||
e=e||event; //兼容ie和其他浏览器的写法
|
||||
if ((mouseDownY > clickBoxTop && mouseDownY < clickBoxBottom) || (mouseDownX > clickBoxLeft && mouseDownX < clickBoxRight)){
|
||||
direction = 'move';
|
||||
}
|
||||
}
|
||||
// if(clickBox.id=="chatHeader" ){
|
||||
// e=e||event; //兼容ie和其他浏览器的写法
|
||||
// if ((mouseDownY > clickBoxTop && mouseDownY < clickBoxBottom) || (mouseDownX > clickBoxLeft && mouseDownX < clickBoxRight)){
|
||||
// direction = 'move';
|
||||
// }
|
||||
// }
|
||||
|
||||
if(direction!=0){
|
||||
if(direction=="left" || direction=="right"){
|
||||
clickBox.style.cursor='w-resize'
|
||||
}else if(direction=="top" || direction=="bottom"){
|
||||
clickBox.style.cursor='s-resize'
|
||||
}else if(direction == "move"){
|
||||
clickBox.style.cursor="auto"
|
||||
}else {
|
||||
clickBox.style.cursor="auto"
|
||||
}
|
||||
|
Reference in New Issue
Block a user