From babcf4f0462ed0945fcefe59b1666d709910872c Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@163.com>
Date: 星期一, 04 三月 2024 16:00:55 +0800
Subject: [PATCH] Merge branch 'master' of http://47.97.1.152:5880/r/zy-asrs-master

---
 zy-asrs-flow/src/pages/map/player.js |   47 +++++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 43 insertions(+), 4 deletions(-)

diff --git a/zy-asrs-flow/src/pages/map/player.js b/zy-asrs-flow/src/pages/map/player.js
index d78c682..4b5a39b 100644
--- a/zy-asrs-flow/src/pages/map/player.js
+++ b/zy-asrs-flow/src/pages/map/player.js
@@ -6,7 +6,7 @@
     constructor(dom, dark) {
         this.darkModel = dark;
         // init
-        this.app = generatePixiApp();
+        this.app = generatePixiApp(dark);
         dom.appendChild(this.app.view);
 
         globalThis.__PIXI_APP__ = this.app;
@@ -77,6 +77,7 @@
             fontFamily: 'MicrosoftYaHei',
             fontWeight: 'bold',
         });
+        coordinatesText.name = 'xyStr'
         coordinatesText.position.set(10, 10);
         this.app.stage.addChild(coordinatesText);
 
@@ -88,18 +89,56 @@
         this.app.view.addEventListener('mousemove', mouseMoveInfoTextHandler);
     }
 
+    showGridlines = () => {
+        if (!this.gridLineContainer) {
+            this.gridLineContainer = generatePixiContainer('gridLineContainer');
+            this.app.stage.addChild(this.gridLineContainer);
+        }
+
+        const inte = 30;
+        const lineDefaultAlpha = .5;;
+        const lineDefaultColor = 0x000000;
+        for (let i = 0; i < this.app.view.width / inte; i++) {
+            const graphics = new PIXI.Graphics();
+            graphics.lineStyle(.3, lineDefaultColor, lineDefaultAlpha);
+            graphics.beginFill(lineDefaultColor);
+            graphics.moveTo(i * inte, 0);
+            graphics.lineTo(i * inte, this.app.view.height);
+            graphics.endFill();
+            this.gridLineContainer.addChild(graphics);
+        }
+
+        for (let i = 0; i < this.app.view.height / inte; i++) {
+            const graphics = new PIXI.Graphics();
+            graphics.lineStyle(.3, lineDefaultColor, lineDefaultAlpha);
+            graphics.beginFill(lineDefaultColor);
+            graphics.moveTo(0, i * inte);
+            graphics.lineTo(this.app.view.width, i * inte);
+            graphics.endFill();
+
+            this.gridLineContainer.addChild(graphics);
+        }
+    }
+
+    hideGridlines = () => {
+        if (this.gridLineContainer) {
+            this.app.stage.removeChild(this.gridLineContainer);
+            this.gridLineContainer = null;
+        }
+    }
+
     appTicker = () => {
         TWEEDLE.Group.shared.update();
     }
 
 }
 
-function generatePixiApp() {
+function generatePixiApp(dark) {
     const app = new PIXI.Application({
-        background: '#F8FAFB',
+        background: dark ? '#f1f2f6' : '#f1f2f6',
         antialias: true,
     })
-    app.stage.eventMode = 'auto';
+    app.stage.eventMode = 'static';
     app.stage.hitArea = app.screen;
     return app;
 }

--
Gitblit v1.9.1