rungwiroon / BlazorGoogleMaps

Blazor interop for GoogleMap library
MIT License
319 stars 102 forks source link

ControlPosition.LeftTop ends up in BottomCenter #281

Closed jakob-reesalu closed 10 months ago

jakob-reesalu commented 10 months ago

So the LeftTop option puts stuff in BottomCenter. I thought that maybe LeftTop was wrongly mapped to BottomCenter. I found the function below which seems to do some mapping, but there's no LEFT_TOP option mapping to BOTTOM_CENTER. Actually, there's no LEFT_TOP at all but instead there are two LEFT_CENTER.

This got to be the issue no? Any idea why LEFT_TOP would map to BOTTOM_CENTER at all? I thought things would default to TOP_LEFT if there's an issue.

(GoogleMapsComponents/wwwroot/js/objectManager.js)


        //https://developers.google.com/maps/documentation/javascript/reference/control#ControlPosition
        switch (positionString) {
            case "BOTTOM_CENTER":
                return google.maps.ControlPosition.BOTTOM_CENTER;
            case "BOTTOM_LEFT":
                return google.maps.ControlPosition.BOTTOM_LEFT;
            case "BOTTOM_RIGHT":
                return google.maps.ControlPosition.BOTTOM_RIGHT;
            case "LEFT_BOTTOM":
                return google.maps.ControlPosition.LEFT_BOTTOM;
            case "LEFT_CENTER":
                return google.maps.ControlPosition.LEFT_CENTER;
            case "LEFT_CENTER":
                return google.maps.ControlPosition.LEFT_CENTER;
            case "RIGHT_BOTTOM":
                return google.maps.ControlPosition.RIGHT_BOTTOM;
            case "RIGHT_CENTER":
                return google.maps.ControlPosition.RIGHT_CENTER;
            case "RIGHT_TOP":
                return google.maps.ControlPosition.RIGHT_TOP;
            case "TOP_CENTER":
                return google.maps.ControlPosition.TOP_CENTER;
            case "TOP_LEFT":
                return google.maps.ControlPosition.TOP_LEFT;
            case "TOP_RIGHT":
                return google.maps.ControlPosition.TOP_RIGHT;
            default:
                return google.maps.ControlPosition.BOTTOM_CENTER;
        }
    }```
valentasm1 commented 10 months ago

Could you give sample how it should be?

jakob-reesalu commented 10 months ago

I'm not exactly sure, but I guess one of these,

case "LEFT_CENTER":
                return google.maps.ControlPosition.LEFT_CENTER;

should be replaced with:

case "LEFT_TOP":
                return google.maps.ControlPosition.LEFT_TOP;

So the updated function would look like this:

switch (positionString) {
            case "BOTTOM_CENTER":
                return google.maps.ControlPosition.BOTTOM_CENTER;
            case "BOTTOM_LEFT":
                return google.maps.ControlPosition.BOTTOM_LEFT;
            case "BOTTOM_RIGHT":
                return google.maps.ControlPosition.BOTTOM_RIGHT;
            case "LEFT_BOTTOM":
                return google.maps.ControlPosition.LEFT_BOTTOM;
            case "LEFT_CENTER":
                return google.maps.ControlPosition.LEFT_CENTER;
            case "LEFT_TOP":
                return google.maps.ControlPosition.LEFT_TOP;
            case "RIGHT_BOTTOM":
                return google.maps.ControlPosition.RIGHT_BOTTOM;
            case "RIGHT_CENTER":
                return google.maps.ControlPosition.RIGHT_CENTER;
            case "RIGHT_TOP":
                return google.maps.ControlPosition.RIGHT_TOP;
            case "TOP_CENTER":
                return google.maps.ControlPosition.TOP_CENTER;
            case "TOP_LEFT":
                return google.maps.ControlPosition.TOP_LEFT;
            case "TOP_RIGHT":
                return google.maps.ControlPosition.TOP_RIGHT;
            default:
                return google.maps.ControlPosition.BOTTOM_CENTER;
        }
valentasm1 commented 10 months ago

So strange that no one ever had issues with it :). https://github.com/rungwiroon/BlazorGoogleMaps/releases/tag/3.2.2 Thank you for help.