| | |
| | | DEVICE_SPRITE_TINT, |
| | | DEVICE_SELECTED_EFFECT_PADDING, |
| | | DEVICE_SELECTED_EFFECT_COLOR, |
| | | POINT_ROUTE_DIRECTION, |
| | | } from './constants'; |
| | | import { getRouteList } from './http'; |
| | | import PointRoute from "./PointRoute"; |
| | | |
| | | import shelf from '/map/shelf.svg'; |
| | | import charge from '/map/charge.svg'; |
| | |
| | | effectCircle.position.set(selectedSprite.x, selectedSprite.y); |
| | | }; |
| | | |
| | | export const showRoutes = (curZone, setShowRoutes) => { |
| | | setShowRoutes(true); |
| | | getRouteList(curZone, (routeList) => { |
| | | routeList.forEach(route => { |
| | | const startPoint = querySprite(DEVICE_TYPE.POINT, route.startCodeStr); |
| | | const endPoint = querySprite(DEVICE_TYPE.POINT, route.endCodeStr); |
| | | const pointRoute = new PointRoute(POINT_ROUTE_DIRECTION[route.direction]); |
| | | pointRoute.setPoint(startPoint, endPoint); |
| | | pointRoute.clear(); |
| | | pointRoute.lineStyle(10, 0x2d3436); |
| | | pointRoute.moveTo(startPoint.position.x, startPoint.position.y); |
| | | pointRoute.lineTo(endPoint.position.x, endPoint.position.y); |
| | | pointRoute.alpha = 1; |
| | | mapContainer.addChild(pointRoute); |
| | | }) |
| | | }) |
| | | }; |
| | | |
| | | export const hideRoutes = (curZone, setShowRoutes) => { |
| | | setShowRoutes(false); |
| | | for (let i = mapContainer.children.length - 1; i >= 0; i--) { |
| | | const child = mapContainer.children[i]; |
| | | if (child?.type === DEVICE_TYPE.ROUTE) { |
| | | mapContainer.removeChild(child); |
| | | } |
| | | } |
| | | } |
| | | |
| | | export const multipleSelectEnhancer = (selectedSprites, setCurSprite, setBatchSprites) => { |
| | | selectedSprites = selectedSprites.filter(sprite => sprite.data?.type); |
| | | |