Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PNG export shifted #714

Open
fgnievinski opened this issue Sep 18, 2024 · 2 comments
Open

PNG export shifted #714

fgnievinski opened this issue Sep 18, 2024 · 2 comments

Comments

@fgnievinski
Copy link

compare exported PNG:
export

with embedded map display:
image

https://overpass-turbo.eu/s/1Rl6

@zhayes84
Copy link

zhayes84 commented Sep 25, 2024

I'm having this exact same issue. Does the same thing in Firefox Version 130.0.1 (64-bit) and Chrome Version 129.0.6668.70.
https://overpass-turbo.eu/s/1RKn

Exported Image:
export(11)

In Browser:
Untitled

@zhayes84
Copy link

zhayes84 commented Sep 25, 2024

This issue occurs on both versions of Overpass Turbo, including the alpha version at https://tyrasd.github.io/.

The code relative to this issue might be here at line 2233:

    const height = $("#map .leaflet-overlay-pane svg").height();
    const width = $("#map .leaflet-overlay-pane svg").width();
    const tmp = $("#map .leaflet-map-pane")[0].style.cssText.match(
      /.*?(-?\d+)px.*?(-?\d+)px.*/
    );
    const offsetX = +tmp[1];
    const offsetY = +tmp[2];
    const svg = $("#map .leaflet-overlay-pane").html();
    if (svg.length > 0) {
      const v = await Canvg.from(ctx, svg, {
        ignoreAnimation: true,
        ignoreClear: true,
        ignoreDimensions: true,
        ignoreMouse: true,
        offsetX,
        offsetY,
        scaleHeight: height,
        scaleWidth: width
      });
      v.render();
    }

In my browser, the line being read by the regular expression is this:

<div class="leaflet-pane leaflet-map-pane" style="transform: translate3d(0px, -206px, 0px);"></div>

Meaning the regular expression nabs (0px, -206px, 0px) for offsetX and offsetY.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants