Junjie
2024-03-25 c4c29d91cccfccf457594b87d09c0181f8810ba2
zy-asrs-flow/src/pages/map/utils.js
@@ -38,6 +38,12 @@
    AGV: "AGV",
})
export const SHELF_TYPE = Object.freeze({
    STORE: 0,
    TRACK: 3,
    DISABLE: 1,
})
export const getRealPosition = (x, y, mapContainer) => {
    const rect = app.view.getBoundingClientRect();
    return {
@@ -253,6 +259,7 @@
    copiedSprite.rotation = sprite.rotation;
    copiedSprite.data = deepCopy(sprite.data);
    copiedSprite.data.uuid = generateID();
    showSheflType(copiedSprite);
    return copiedSprite;
}
@@ -356,10 +363,13 @@
                // dynamical data
                Object.assign(sprite.data, item.property);
                showSheflType(sprite);
                // graph
                sprite.position.set(item.positionX, item.positionY);
                sprite.scale.set(item.scaleX, item.scaleY);
                sprite.rotation = rotationParseNum(item.rotation);
                // sprite.tint = '#000';
                mapContainer.addChild(sprite);
            }
        })
@@ -462,4 +472,24 @@
        closeIcon: false,
        onClick: () => { }
    });
}
export const showSheflType = (sprite) => {
    let showColor;
    switch (sprite.data.shelfType) {
        case SHELF_TYPE.STORE:
            break;
        case SHELF_TYPE.TRACK:
            showColor = '#faf6e9';
            break;
        case SHELF_TYPE.DISABLE:
            showColor = '#ffc8c8';
            break;
        default:
            break;
    }
    if (showColor) {
        sprite.tint = showColor;
    }
    return showColor;
}