Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
390
How do you center a shape file inside the container where backgroundContent = null?
posted

I have a igMap with a type: type: "geographicShape", backgroundContent = null;

shapeDataSource: '../../data-files/shapes/test.shp',
databaseSource: '../../data-files/shapes/test.dbf',

  windowRect: {top: 0.35482880331323446, left: 0.32046170218611925, width: 0.07144929000000011, height: 0.07144929000000011 } set to these values. 

It's all centered when the window is maximized, but when the window is re-sized the the shape file is not centered in the div. How do I keep the shape file always centered within the window? 

  • 30692
    Offline posted

    The window rect that you ask for isn't necessarily the window rect you are going to get. It is corrected so that the aspect ratio matches the shape of the map. You can use the public methods on the map to convert from geographic coordinates to window coordinates as the viewport size changes. The map will fire the gridAreaRectChanged event when the viewport size changes, so thsi is a good place to convert from geographic coordinates to window coordinates and update the zoom level.