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

width undefined #32

Closed
sommerbernd opened this issue Jul 27, 2017 · 11 comments
Closed

width undefined #32

sommerbernd opened this issue Jul 27, 2017 · 11 comments

Comments

@sommerbernd
Copy link

@rowanwins
Me again. Updated demo is working. But when I try to save a map shown in my own app I get this error with Chrome debugger:

bundle.js:1 oops, something went wrong! TypeError: Cannot read property 'width' of undefined
at e._resizeAndPrintMap (bundle.js:1)
at bundle.js:1
at

Setting the width of the map container to 900px (instead of 96%) does not help. Can I do something else to make my app save the map?
bsommer@bsommer.de

@rowanwins
Copy link
Owner

Can you show me a snippet of how you are initiating the plugin, eg what options you are passing?

@sommerbernd
Copy link
Author

sommerbernd commented Jul 27, 2017 via email

@sommerbernd
Copy link
Author

sommerbernd commented Jul 27, 2017 via email

@rowanwins
Copy link
Owner

Does it happen with any of the size modes in particular or all of them? What if you try the print mode?

@sommerbernd
Copy link
Author

sommerbernd commented Jul 30, 2017 via email

@rowanwins
Copy link
Owner

Hi @sommerbernd

I've just published v2.1.0 to npm so perhaps try and install that and see how you go. I've also included a sourcemap so hopefully that should give you a more meaningful look at where the error is coming from.

Let me know how you get on

@sommerbernd
Copy link
Author

sommerbernd commented Aug 1, 2017 via email

@rowanwins
Copy link
Owner

Hey @sommerbernd ,

yeah sorry I forgot to update that bit of the docs so the bundle.js is correct.

So if I understand correctly you're getting this error when you try to integrate an leaflet app with the plugin into AppStudio. If I look at the AppStudio website it looks like it's being deprecated. I don't really have any idea about AppStudio or it's development so I probably can't provide any assistance sorry.

@sommerbernd
Copy link
Author

sommerbernd commented Aug 2, 2017 via email

@rowanwins
Copy link
Owner

Hmm ok, so looking at your config you aren't passing in a tile layer which is why you might be getting this issue bundle.js:1 Uncaught TypeError: Cannot read property 'isLoading' of undefined

So I'd probably have code look something like


var tiles = L.tileLayer("https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png", {
    attribution: "<a href='https://openstreetmap.org/copyright'>OpenStreetMap</a> contributors",
    crossOrigin: true
}).addTo(mapNSB);

L.easyPrint({
        title: 'Sie können auch als PDF drucken/speichern und die Karte als Anhang senden!',
        tileLayer: tiles,
        position: 'topleft',
        sizeModes: ['Current','A4Portrait', 'A4Landscape'],
        exportOnly: true,
        filename: 'MeinePositionKarte'
       }).addTo(mapNSB);

Notice that I've added the tileLayer property to the options.

This is a bug in my code that means it's looking for this config option even though it's not mandatory. So I'll release a fix but the above should hopefully get you past the bug for the timebeing.

@sommerbernd
Copy link
Author

sommerbernd commented Aug 2, 2017 via email

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