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