R
R
rinatoptimus2016-10-21 12:21:15
API
rinatoptimus, 2016-10-21 12:21:15

Why is the mark on the Yandex map not zoomed?

The label (or balun - which is correct?) represents the outline of the building. When the map is zoomed, the marker does not change its size and it is not clear how to remove the "How to get there?" element from the map:

var ymaps,lastRoute;
      if(typeof ymaps !== 'undefined') {
    ymaps.ready(function() {
      myMap = new ymaps.Map('map', {
        //center: [55.788668, 49.099914],
        center: [59.88157957, 30.31588162],
        zoom: 16,
        //controls: ["zoomControl", "trafficControl", "geolocationControl", "routeEditor", "rulerControl"]
        controls: ["geolocationControl"]
      });
      //doRoute([55.788668, 49.099914]);


 
      // test begin
      /*var myPlacemark = new ymaps.Placemark([59.88157957, 30.31566162] , {
        hintContent: 'test"'
      },
          { iconLayout: 'default#image',
            iconImageHref: './img/map-balloon.png',
            iconImageSize: [300, 157],
            iconImageOffset: [-110, -67] });      
      myMap.geoObjects.add(myPlacemark);*/
      var myPlacemark = new ymaps.Placemark([59.88157957, 30.31566162] , {
        hintContent: 'test"'
      },
          { iconLayout: 'default#image',
            iconImageHref: './img/map-balloon.png',
            //iconImageSize: [170, 80],
            iconImageSize: [300, 157],
            iconImageOffset: [-110, -47] });      
      myMap.geoObjects.add(myPlacemark);
      // test end




    });
    doRoute = function(pos) {
          ymaps.route([
            pos,
            //[55.779894, 49.128862]
            [59.88157957, 30.31566162]
          ], {
            boundedBy: myMap.getBounds(),
            mapStateAutoApply: true
          }).then(function (route) {
            lastRoute = route;
            myMap.geoObjects.add(route);

            var points = route.getWayPoints(),
                lastPoint = points.getLength() - 1,
                paths = route.getPaths();

            paths.options.set({
              strokeColor: '50caef',
              strokeWidth: 5,
              opacity: 0.9
            });


          }, function (error) {
            alert('Возникла ошибка: ' + error.message);
          });
        },
        removeRoute = function() {
          lastRoute && myMap.geoObjects.remove(lastRoute);
        };
  }


  $(document).on('submit', '.enter_address_form', function(e) {
    e.preventDefault();
    var $form = $(this),
        $input = $form.find('[name="address"]'),
        address = $input.val();

    removeRoute();
    doRoute(address);
    $input.blur();

    return false;
  });

Answer the question

In order to leave comments, you need to log in

1 answer(s)
F
freeExec, 2016-10-25
@freeExec

Because a label is just a picture nailed to the right place. For something to scale, it must be geometry, such as the outline of a house. Technically, you can prepare icons for all zooms by adjusting their size, or even generate svg on the fly, but is it necessary?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question