-
Notifications
You must be signed in to change notification settings - Fork 14
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
Problem with TileLayerOptions. #12
Comments
Hi, Thanks for reporting. I could reproduce the issue. I am trying to troubleshoot it |
It turnouts the map pane should be created before using the TileLayer, so something like that works:
Sorry the method createPane was missing, I have just added it in the last commit. Maybe it is better to add it as an argument of the Builder to make it a required field. You should be able to use it with 1.0-SNAPSHOT. |
Hi all, I have experienced the same problem and I both figured out the reason and found a solution. First: the solution is to patch the leaflet JS source:
The reason for this is that the native JS object created by |
@ciaccia Thanks. It's an even better solution if it is handled by leaflet source Js. are you intending to submit the patch to leaflet Js project? |
Hi Zak905, It is possible to fix the issue in GWT, using old "native" JavaScriptObject objects for the options instead of JsType. I have converted two lasses, everything works fine even without changing Leaflet's JavaScript. https://www.dropbox.com/s/p7p89qitipe93t8/TileLayerOptions.java?dl=0 The trick is to generate JS objects without any "prototyped superclass", and to add the options to the object's internal map. I forgot to mention that |
Hi @ciaccia, Thanks for your remarks and your solution. I actually thought that this was a pure Leaflet Js bug, based on your previous answer. Off course, I would not expect a change to be made to Leaflet Js for fixing an issue here. I actually was using JSNI before for all Options, and I decided to change to JsInterop to make everything 100% JsInterop. 898da51 Your solution seems reasonable, I will test it, and if it works out for everything, I will introduce the changes. I forgot that Js objects can be used as associative arrays. and Yes com.gwidgets.api.leaflet.events.Event shoud be an object. |
Hi @ciaccia, I actually could not reproduce the bugs you pointed out.
I am sure that the Unless we can reproduce the bugs clearly, I will not be able to integrate your solution, sorry. The solution above still holds for the bug reported by @evgenyt |
Hi @zak905,
This will then overwrite the default value of The second point if not relevant anymore. The |
Hi @ciaccia,
I used a break point in setOptions in Chrome and it produces the expected output. Unless you can give a use case with an error stack trace, I will not be able to qualify this as a bug. |
Hi zak905, Let's say you use your "normal" code (not the one with the JNSI trick I provided) and you execute the following snippet:
When the JsInteroped Edit: just to be on the safe side, I never mentioned an exception or a stacktrace happening in |
Would you like to submit a PR ? |
@ciaccia nevermind. I found a better solution to the problem, without polluting the code base with JSNI. All I needed to do is to remove all default values ( they are provided by .js) and check if the value is null before making an assignement in the builder e.g: https://github.com/gwidgets/gwty-leaflet/blob/master/src/main/java/com/gwidgets/api/leaflet/options/TileLayerOptions.java @evgenyt You can use the title options objects now without having to use |
Hi @zak905 , I still have to test your commit, but if what you say is correct you found the right fix for the issue! In case I spot something else I will get back to you. Cheers and thanks |
When you try to use TileLayerOptions as argument 'options' of L.tileLayer method (otherwise of null)
this provide next JavaScript error:
The 'null' argument work correctly
gwty-leaflet: 0.5 and 1.0-SNAPSHOT, GWT 2.8.0 and 2.8.1
The text was updated successfully, but these errors were encountered: