#
luxiaotao1123
2024-10-10 cbd9fde3a2f8d4f5c45bea1a5215ad843e8dabc6
zy-acs-flow/src/map/player.js
@@ -17,6 +17,7 @@
        this.activateMapScale();
        this.activateMapPan();
        this.showCoordinates();
        this.startupTicker();
        const bunny = PIXI.Sprite.from('https://pixijs.com/assets/bunny.png');
@@ -32,8 +33,6 @@
    activateMapMultiSelect = (fn) => {
        const mapMultiSelectHandle = (event) => {
            console.log(123);
            if (event.button !== 0) {
                return;
            }
@@ -102,6 +101,7 @@
                        fn(this.selectedSprites, () => {
                            // trigger at end of selectionBox when fn happen mouseup
                            this.selectedSprites = [];
                            this.activateMapMultiSelect(fn);
                        });
                    }
@@ -111,6 +111,7 @@
            });
        }
        this.mapContainer.parent.off('mousedown');
        this.mapContainer.parent.on('mousedown', mapMultiSelectHandle)
    }
@@ -226,6 +227,25 @@
            }, 200).start();
    }
    showCoordinates = () => {
        const coordinatesText = new PIXI.Text('{ x: 0, y: 0 }', {
            fill: this.themeMode === 'dark' ? 0xffffff : 0x000000,
            fontSize: 13,
            fontFamily: 'MicrosoftYaHei',
            fontWeight: 'bold',
        });
        coordinatesText.name = 'xyStr'
        coordinatesText.position.set(10, 10);
        this.app.stage.addChild(coordinatesText);
        const mouseMoveInfoTextHandler = (event) => {
            const mouseX = (event.clientX - this.mapContainer.position.x) / this.scale;
            const mouseY = (event.clientY - this.mapContainer.position.y) / this.scale;
            coordinatesText.text = `{ x: ${mouseX.toFixed(2)}, y: ${mouseY.toFixed(2)} }`;
        };
        this.app.view.addEventListener('mousemove', mouseMoveInfoTextHandler);
    }
    showGridLines = () => {
        this.hideGridLines();
        if (!this.gridLineContainer) {
@@ -265,7 +285,6 @@
        }
    }
    startupTicker = () => {
        this.app.ticker.add((delta) => {
            TWEEDLE.Group.shared.update();
@@ -274,10 +293,6 @@
    resize = (width, height) => {
        this.app.renderer.resize(width, height);
        this.mapContainer.children.forEach((child) => {
            child.x = width / 2;
            child.y = height / 2;
        });
    }
    destroy = () => {