LeafletForBlazor-NuGet icon indicating copy to clipboard operation
LeafletForBlazor-NuGet copied to clipboard

Custom CRS Support

Open Alexr03 opened this issue 8 months ago • 1 comments

Hey! Great library! I am really wanting to use this to show a game map (not the real world map). To do this I need to apply a custom CRS.

CUSTOM_CRS = L.extend({}, L.CRS.Simple, {
    projection: L.Projection.LonLat,
    scale: function(zoom) {
        return Math.pow(2, zoom);
    },
    zoom: function(sc) {
        return Math.log(sc) / 0.6931471805599453;
    },
    distance: function(pos1, pos2) {
        let x_difference = pos2.lng - pos1.lng;
        let y_difference = pos2.lat - pos1.lat;
        return Math.sqrt(x_difference * x_difference + y_difference * y_difference);
    },
    transformation: new L.Transformation(scale_x, center_x, -scale_y, center_y),
    infinite: true,
});

Im unsure whether this library can currently do this, if not I would love to see this functionality added! :)

Thanks.

Alexr03 avatar Jun 24 '24 00:06 Alexr03