简体   繁体   中英

Dont work Get x and y pixel of touched in version 4.2.0 to high of Carto mobile SDK

i want to get pixel x and y of map with touched but dont work in version 4.2.0 and higher. and it work in version 4.1.3 and older.

in version 4.1.3 this code is work:

            @Override
            public boolean onRasterTileClicked(RasterTileClickInfo clickInfo) {
                MapTile mapTile = clickInfo.getMapTile();
                Projection proj = rasterLayer.getDataSource().getProjection();
                double projTileWidth = proj.getBounds().getDelta().getX() / (1 << mapTile.getZoom());
                double projTileHeight = proj.getBounds().getDelta().getY() / (1 << mapTile.getZoom());
                double projTileX0 = proj.getBounds().getMin().getX() + mapTile.getX() * projTileWidth;
                double projTileY0 = proj.getBounds().getMin().getY() + ((1 << mapTile.getZoom()) - 1 - mapTile.getY()) * projTileHeight;
                double normTileX = (clickInfo.getClickPos().getX() - projTileX0) / projTileWidth;
                double normTileY = (clickInfo.getClickPos().getY() - projTileY0) / projTileHeight;
                Log.d("", "Clicked at: " + (int) (normTileX * 256) + ", " + (int) (normTileY * 256));
                return true;
            }
        }); ```

Can you try with last RC (4.3.0-rc.2) version from https://github.com/CartoDB/mobile-sdk/releases ? You may have hit this fixed issue: https://github.com/CartoDB/mobile-sdk/issues/354

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM