Projekt

Obecné

Profil

« Předchozí | Další » 

Revize 08be9ecd

Přidáno uživatelem Fantič před více než 1 rok

re #10871: PlanViewPage: Populate rooms and labels, highlight selected room

Zobrazit rozdíly:

src/stores/actions/planThunks.ts
28 28

  
29 29
                    unstructeredRoomList.map((room) => {
30 30
                        if (room.floor in floorsDict) {
31

  
32
                            // TODO handle on backend transformations :-)
33
                            if (room.floor == "first_floor") {
34
                                room.number_x = room.number_x - 1044.46
35
                                room.number_y = room.number_y - 1088.65
36
                            }
37
                            else if (room.floor == "second_floor") {
38
                                room.number_x = room.number_x - 2088.7
39
                                room.number_y = room.number_y - 1088.58
40
                            }
41

  
31 42
                            floorsDict[room.floor].roomList.push(room)
32 43
                        }
33 44
                        else {
......
128 139
                const response = await getPlanFloorImageRequest(floorId)
129 140

  
130 141
                if (response.status === 200) {
131
                    
132
                    const svg : string = response.data 
133 142

  
134
                    const output : PlanImage = {
143
                    const svg: string = response.data
144

  
145
                    const output: PlanImage = {
135 146
                        svg: svg,
136
                        viewBox :{ x:0, y:0, width:0, height:0 }
147
                        viewBox: { x: 0, y: 0, width: 0, height: 0 }
137 148
                    }
138 149

  
139
                    parseString(svg, (err : any, result: any) => {
150
                    parseString(svg, (err: any, result: any) => {
140 151
                        if (!err && result && result.svg && result.svg.$.viewBox) {
141
                          const [x, y, width, height] = result.svg.$.viewBox.split(' ').map(Number);
142
                    
143
                          // Set the SVG information in your component's state or use it as needed
144
                          output.viewBox =  { x, y, width, height };
152
                            const [x, y, width, height] = result.svg.$.viewBox.split(' ').map(Number);
153

  
154
                            // Set the SVG information in your component's state or use it as needed
155
                            output.viewBox = { x, y, width, height };
145 156
                        }
146
                      });
157
                    });
147 158

  
148 159
                    return output
149 160
                } else {

Také k dispozici: Unified diff