webix-hub/components

Openmap has problem rendering if resources are inserted before

lcguida opened this issue · 1 comments

I found a strange behavior in the openmap (leaflet - openstreetmaps) component. If I include leaflet resources before the component creation, the map doesn't render well.
If I resize the window, the display is correct, but the initial state isn't.

Here is a working code reproducing the problem (got it from openmaps example):

https://github.com/lcguida/webix-openmap-problem

The only change is in the sample.html file where I included leaflet in the head tag:

<!doctype html>
<html>
<head>
    <script type="text/javascript" src="http://cdn.webix.io/edge/webix.js"></script>
    <link rel="stylesheet" type="text/css" href="http://cdn.webix.io/edge/webix.css">

    <!-- Including Leaflet Before Webix component -->
    <link rel="stylesheet" type="text/css" href="./leaflet/leaflet.css">
    <script type="text/javascript" src="./leaflet/leaflet.js"></script>

    <script type="text/javascript" src="./openmap.js"></script>
</head>
<body>
    <div id="sample_div" style='width:600px; height:300px; margin:50px;'></div>
    <script type="text/javascript">
        //path from which autoload extra libraries
        webix.codebase = "./";
        webix.ui({
            container:"sample_div",
            view:"open-map",
            id:"map",
            zoom:6,
            center:[ 48.724, 8.215 ]
        });
    </script>
</body>
</html>

I couldn't really find the root of the problem, but in my case, I need to load the resources before.
Any ideas of why is it happening ?

The issue may be caused by the mixing different version of Leaflet ( one included manually, and one auto-loaded by extension )

The latest version seems work correctly https://snippet.webix.com/1o1ij2l7