| | |
| | | setDeviceVisible(false); |
| | | setSettingsVisible(false); |
| | | setBatchSelectionVisible(false); |
| | | setAreaDrawing(false); |
| | | |
| | | setCurSprite(null); |
| | | setBatchSprites([]); |
| | |
| | | sx={{}} |
| | | disabled={areaDrawing} |
| | | onClick={() => { |
| | | setCurSprite(null); |
| | | const started = Tool.startAreaDrawing({ |
| | | promptText: translate('page.map.prompt.areaName'), |
| | | onComplete: ({ name, start, end, color }) => { |
| | |
| | | |
| | | let areaDrawingCleanup = null; |
| | | const AREA_COLOR = 0x3498db; |
| | | const AREA_BORDER_COLOR = 0x6c7a89; |
| | | |
| | | const addAreaLabel = (draft, text, from, to) => { |
| | | const centerX = (from.x + to.x) / 2; |
| | |
| | | const draft = new PIXI.Graphics(); |
| | | draft.name = id ? `area_${id}` : 'area_' + generateID(); |
| | | draft.zIndex = DEVICE_Z_INDEX.AREA; |
| | | draft.lineStyle(2 / Math.abs(mapContainer.scale.x || 1), 0x6c7a89, 0.9); |
| | | draft.lineStyle(2 / Math.abs(mapContainer.scale.x || 1), AREA_BORDER_COLOR, 0.9); |
| | | draft.beginFill(areaColor, 0.18); |
| | | draft.drawRect( |
| | | Math.min(from.x, to.x), |
| | |
| | | const drawRect = (from, to) => { |
| | | draft.clear(); |
| | | const strokeColor = areaColor; |
| | | draft.lineStyle(2 / Math.abs(mapContainer.scale.x || 1), 0x6c7a89, 0.9); |
| | | draft.lineStyle(2 / Math.abs(mapContainer.scale.x || 1), AREA_BORDER_COLOR, 0.9); |
| | | draft.beginFill(strokeColor, 0.18); |
| | | draft.drawRect( |
| | | Math.min(from.x, to.x), |