Skip to content
This repository was archived by the owner on Jul 27, 2023. It is now read-only.
This repository was archived by the owner on Jul 27, 2023. It is now read-only.

Wrong initialization scrip of the map #41

Open
@bobonov

Description

@bobonov

Since the map is initialized in the following way:

function map_init(){
    var map = L.map('w0', {});

this make map unavailable in global scope therefore is impossible to operate via javascript on the map (ie change the center)
Something, at javascript level, like this should work.

var map;
function map_init(){
    map = L.map('w0', {});

So in the php code in Map.php:
line 103 from

array_unshift($js, "var $name = L.map('$id', $options);");

to

array_unshift($js, "$name = L.map('$id', $options);");

and line 122

$view->registerJs("function {$name}_init(){\n" . implode("\n", $js) . "}\n{$name}_init();");

to

$view->registerJs("var {$name};\nfunction {$name}_init(){\n" . implode("\n", $js) . "}\n{$name}_init();");

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions