From 614c94e0b079b4d51e96bc02add92b04100bd07b Mon Sep 17 00:00:00 2001
From: Junjie <fallin.jie@qq.com>
Date: 星期六, 21 三月 2026 09:12:23 +0800
Subject: [PATCH] #
---
src/main/webapp/components/MapCanvas.js | 34 +++++++++++++++++++++++++++-------
1 files changed, 27 insertions(+), 7 deletions(-)
diff --git a/src/main/webapp/components/MapCanvas.js b/src/main/webapp/components/MapCanvas.js
index 4c2292e..a4c0a7d 100644
--- a/src/main/webapp/components/MapCanvas.js
+++ b/src/main/webapp/components/MapCanvas.js
@@ -77,6 +77,8 @@
},
pixiShelfMap: new Map(),
pixiTrackMap: new Map(),
+ pixiCrnTextureMap: new Map(),
+ pixiRgvTextureMap: new Map(),
pixiDevpTextureMap: new Map(),
pixiCrnColorTextureMap: new Map(),
pixiDevpTextureMap: new Map(),
@@ -787,8 +789,7 @@
});
this.crnList.forEach((item) => {
- if (this.graphicsCrn == null) { this.graphicsCrn = this.createCrnTexture(item.width * 0.9, item.height * 0.9); }
- let sprite = new PIXI.Sprite(this.graphicsCrn);
+ let sprite = this.createCrnSprite(item.width * 0.9, item.height * 0.9);
const deviceNo = this.getDeviceNo(item.value);
const taskNo = this.getTaskNo(item.value);
const style = new PIXI.TextStyle({ fontFamily: 'Arial', fontSize: 12, fill: '#000000', stroke: '#ffffff', strokeThickness: 1 });
@@ -820,8 +821,7 @@
});
this.dualCrnList.forEach((item) => {
- if (this.graphicsCrn == null) { this.graphicsCrn = this.createCrnTexture(item.width * 0.9, item.height * 0.9); }
- let sprite = new PIXI.Sprite(this.graphicsCrn);
+ let sprite = this.createCrnSprite(item.width * 0.9, item.height * 0.9);
const deviceNo = this.getDeviceNo(item.value);
const taskNo = this.getTaskNo(item.value);
const style = new PIXI.TextStyle({ fontFamily: 'Arial', fontSize: 12, fill: '#000000', stroke: '#ffffff', strokeThickness: 1 });
@@ -853,8 +853,7 @@
});
this.rgvList.forEach((item) => {
- if (this.graphicsRgv == null) { this.graphicsRgv = this.createRgvTexture(item.width * 0.9, item.height * 0.9); }
- let sprite = new PIXI.Sprite(this.graphicsRgv);
+ let sprite = this.createRgvSprite(item.width * 0.9, item.height * 0.9);
const deviceNo = this.getDeviceNo(item.value);
const taskNo = this.getTaskNo(item.value);
const style = new PIXI.TextStyle({ fontFamily: 'Arial', fontSize: 12, fill: '#000000', stroke: '#ffffff', strokeThickness: 1 });
@@ -1227,6 +1226,28 @@
if (texture == undefined) {
texture = this.createTrackTexture(width, height, trackMask);
this.pixiTrackMap.set(idx, texture);
+ }
+ return new PIXI.Sprite(texture);
+ },
+ createCrnSprite(width, height) {
+ const w = Math.max(1, Math.round(width));
+ const h = Math.max(1, Math.round(height));
+ const key = w + "-" + h;
+ let texture = this.pixiCrnTextureMap.get(key);
+ if (texture == undefined) {
+ texture = this.createCrnTexture(w, h);
+ this.pixiCrnTextureMap.set(key, texture);
+ }
+ return new PIXI.Sprite(texture);
+ },
+ createRgvSprite(width, height) {
+ const w = Math.max(1, Math.round(width));
+ const h = Math.max(1, Math.round(height));
+ const key = w + "-" + h;
+ let texture = this.pixiRgvTextureMap.get(key);
+ if (texture == undefined) {
+ texture = this.createRgvTexture(w, h);
+ this.pixiRgvTextureMap.set(key, texture);
}
return new PIXI.Sprite(texture);
},
@@ -2799,7 +2820,6 @@
}
}
});
-
--
Gitblit v1.9.1