@@ -141,59 +141,77 @@ const VenueStands: React.FC<VenueStandsProps> = ({ companies }) => {
141
141
centerZoomedOut = { true }
142
142
centerOnInit = { true }
143
143
>
144
- { ( { zoomIn, zoomOut, resetTransform, ...rest } ) => (
145
- < React . Fragment >
146
- < div className = "absolute top-4 right-4 flex flex-col gap-2 z-10" >
147
- < button
148
- onClick = { ( ) => zoomIn ( ) }
149
- className = "button button-primary !bg-sinfo-primary flex-1 p-2 rounded hover:opacity-90 transition-opacity"
150
- >
151
- +
152
- </ button >
153
- < button
154
- onClick = { ( ) => zoomOut ( ) }
155
- className = "button button-primary !bg-sinfo-primary flex-1 p-2 rounded hover:opacity-90 transition-opacity"
156
- >
157
- -
158
- </ button >
159
- { /* <button
144
+ { ( { zoomIn, zoomOut, resetTransform, zoomToElement, ...rest } ) => {
145
+ useEffect ( ( ) => {
146
+ setTimeout ( ( ) => {
147
+ if ( companyParam ) {
148
+ let element = document . getElementById (
149
+ `company-${ companyParam } `
150
+ ) ;
151
+ if ( element ) {
152
+ console . log ( "Zooming to element" , element ) ;
153
+ zoomToElement ( `company-${ companyParam } ` , 3 ) ;
154
+ }
155
+ }
156
+ } , 300 ) ; // Wait for the SVG to render
157
+ } , [ companyParam ] ) ;
158
+
159
+ return (
160
+ < >
161
+ < React . Fragment >
162
+ < div className = "absolute top-4 right-4 flex flex-col gap-2 z-10" >
163
+ < button
164
+ onClick = { ( ) => zoomIn ( ) }
165
+ className = "button button-primary !bg-sinfo-primary flex-1 p-2 rounded hover:opacity-90 transition-opacity"
166
+ >
167
+ +
168
+ </ button >
169
+ < button
170
+ onClick = { ( ) => zoomOut ( ) }
171
+ className = "button button-primary !bg-sinfo-primary flex-1 p-2 rounded hover:opacity-90 transition-opacity"
172
+ >
173
+ -
174
+ </ button >
175
+ { /* <button
160
176
onClick={() => resetTransform()}
161
177
className="button button-primary !bg-sinfo-secondary flex-1 p-2 rounded hover:opacity-90 transition-opacity"
162
178
>
163
179
Reset
164
180
</button> */ }
165
- </ div >
166
- < div className = "relative overflow-hidden border border-gray-300 rounded" >
167
- < TransformComponent >
168
- < svg
169
- viewBox = "0 0 512 380"
170
- className = "w-full h-auto max-w-4xl mx-auto"
171
- >
172
- < Entrances />
173
- < SessionsStands />
174
- < FoodZone />
175
- < CoworkingZone />
176
-
177
- { /* Company Stands */ }
178
- < g id = "stands" >
179
- { standsForSelectedDay . map ( ( stand ) => {
180
- const company = getCompanyAtPosition ( stand . standId ) ;
181
- return (
182
- < CompanyStand
183
- key = { `stand-${ stand . standId } ` }
184
- stand = { stand }
185
- company = { company }
186
- standPositions = { standPositions }
187
- isSelected = { isStandHighlighted ( company ) }
188
- />
189
- ) ;
190
- } ) }
191
- </ g >
192
- </ svg >
193
- </ TransformComponent >
194
- </ div >
195
- </ React . Fragment >
196
- ) }
181
+ </ div >
182
+ < div className = "relative overflow-hidden border border-gray-300 rounded" >
183
+ < TransformComponent >
184
+ < svg
185
+ viewBox = "0 0 512 380"
186
+ className = "w-full h-auto max-w-4xl mx-auto"
187
+ >
188
+ < Entrances />
189
+ < SessionsStands />
190
+ < FoodZone />
191
+ < CoworkingZone />
192
+
193
+ { /* Company Stands */ }
194
+ < g id = "stands" >
195
+ { standsForSelectedDay . map ( ( stand ) => {
196
+ const company = getCompanyAtPosition ( stand . standId ) ;
197
+ return (
198
+ < CompanyStand
199
+ key = { `stand-${ stand . standId } ` }
200
+ stand = { stand }
201
+ company = { company }
202
+ standPositions = { standPositions }
203
+ isSelected = { isStandHighlighted ( company ) }
204
+ />
205
+ ) ;
206
+ } ) }
207
+ </ g >
208
+ </ svg >
209
+ </ TransformComponent >
210
+ </ div >
211
+ </ React . Fragment >
212
+ </ >
213
+ ) ;
214
+ } }
197
215
</ TransformWrapper >
198
216
</ div >
199
217
</ div >
0 commit comments