From 80df92086c27146d992fa8cb91c4d154a6c2c45c Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@163.com>
Date: 星期二, 05 三月 2024 16:56:22 +0800
Subject: [PATCH] #

---
 zy-asrs-flow/src/pages/map/player.js |   18 +++++++++++-------
 1 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/zy-asrs-flow/src/pages/map/player.js b/zy-asrs-flow/src/pages/map/player.js
index 47bed1b..9f3cbee 100644
--- a/zy-asrs-flow/src/pages/map/player.js
+++ b/zy-asrs-flow/src/pages/map/player.js
@@ -4,8 +4,9 @@
 
 export default class Player {
 
-    constructor(dom, dark) {
+    constructor(dom, dark, didClickSprite) {
         this.darkModel = dark;
+        this.didClickSprite = didClickSprite;
         // init
         this.app = generatePixiApp(dark);
         dom.appendChild(this.app.view);
@@ -20,7 +21,7 @@
 
         this.pan = false; // 骞崇Щ
 
-        this.activateMapEvent(null, Utils.MapEvent.PAN)
+        this.activateMapEvent(null, Utils.MapEvent.PAN);
         this.activateMapScale();
         this.showCoordinates();
         this.appTicker();
@@ -28,7 +29,7 @@
 
     activateMapEvent = (leftEvent, rightEvent) => {
         if (this.mapEvent) {
-            this.app.view.removeEventListener('mousemove', this.mapEvent);
+            this.app.view.removeEventListener('mousedown', this.mapEvent);
         }
 
         this.mapEvent = (event) => {
@@ -58,7 +59,6 @@
     }
 
     mapSelect = (event) => {
-        let that = this;
         let isSelecting = false;
 
         const selectionBox = new PIXI.Graphics();
@@ -71,11 +71,11 @@
 
         isSelecting = true;
 
-        function handleMouseMove(event) {
-            if (isSelecting) {
+        const handleMouseMove = (event) => {
+            if (isSelecting && !this.didClickSprite) {
                 // end
                 const endPoint = new PIXI.Point();
-                that.app.renderer.events.mapPositionToPoint(endPoint, event.clientX, event.clientY);
+                this.app.renderer.events.mapPositionToPoint(endPoint, event.clientX, event.clientY);
                 const selectionEnd = { x: endPoint.x, y: endPoint.y }
 
                 const width = Math.abs(selectionEnd.x - selectionStart.x);
@@ -205,6 +205,10 @@
         }
     }
 
+    updateDidClickSprite = (value) => {
+        this.didClickSprite = value;
+    }
+
     appTicker = () => {
         TWEEDLE.Group.shared.update();
     }

--
Gitblit v1.9.1