Sha256: c3f182cad1810a9227f8c4f3f0bb882d425267a70fb4de9562c622f400f706ad

Contents?: true

Size: 1006 Bytes

Versions: 6

Compression:

Stored size: 1006 Bytes

Contents

// нарисовать на карте объекты из указанного
// хэша offices[region_id]

function map_set_objects(region_id) {

    var arr = offices[region_id];
    // console.log(arr);
    var n = arr['count'];

    // соберём коллекцию точек
    var c = new ymaps.GeoObjectCollection();
    var icoords, iprops, isetts; // loop vars
    for (var i = 0; i < n; i++) {
        icoords = arr['coords'][i];
        iprops = arr['props'][i];
        isetts = arr['setts'][i];
        //console.log(isetts);
        c.add(new ymaps.Placemark(icoords, iprops, isetts));
    }

    // сначала уберём все точки
    dealers_map.geoObjects.each(function(o) {
        dealers_map.geoObjects.remove(o)
    });

    dealers_map.geoObjects.add(c);
    dealers_map.setBounds(c.getBounds(), {checkZoomRange:true})
        .then(function() {
            if(dealers_map.getZoom() > 20) {
                dealers_map.setZoom(20);
            }
        });
}

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
c80_push-0.1.0.11 app/assets/javascripts/c80_push/frontend/c80_push_page_dealers/_map_set_objects.js
c80_push-0.1.0.10 app/assets/javascripts/c80_push/frontend/c80_push_page_dealers/_map_set_objects.js
c80_push-0.1.0.8 app/assets/javascripts/c80_push/frontend/c80_push_page_dealers/_map_set_objects.js
c80_push-0.1.0.7 app/assets/javascripts/c80_push/frontend/c80_push_page_dealers/_map_set_objects.js
c80_push-0.1.0.6 app/assets/javascripts/c80_push/frontend/c80_push_page_dealers/_map_set_objects.js
c80_push-0.1.0.5 app/assets/javascripts/c80_push/frontend/c80_push_page_dealers/_map_set_objects.js