Skip to content
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

L.Yandex: fixes, enhancements and refactoring #285

Merged
merged 29 commits into from
Jul 17, 2019

Commits on May 23, 2019

  1. Configuration menu
    Copy the full SHA
    a638b0f View commit details
    Browse the repository at this point in the history
  2. reduce flickering caused by excessive tiles reloading after zoom changes

    for some reason 2 consequtive yandex api calls produced such effect
    replacing two calls with one reduces this a lot
    johndoe committed May 23, 2019
    Configuration menu
    Copy the full SHA
    3d35176 View commit details
    Browse the repository at this point in the history

Commits on May 24, 2019

  1. L.Yandex: fix panning lags

    It's that simple. Just wrong function was used)
    
    Fix shramov#253, and part of shramov#111.
    
    Note: zoom animation still fails
    (shramov#129)
    johndoe committed May 24, 2019
    Configuration menu
    Copy the full SHA
    b2d4528 View commit details
    Browse the repository at this point in the history

Commits on May 30, 2019

  1. L.Yandex: fix overlay option

    johndoe committed May 30, 2019
    Configuration menu
    Copy the full SHA
    0f5a413 View commit details
    Browse the repository at this point in the history

Commits on Jun 10, 2019

  1. L.Yandex: factory function L.yandex; type can be omitted if inclu…

    …ded in `options`
    
    ---
    @factory L.yandex(<String> type?, <Object> options)
    Instantiates a Yandex layer object given `type` and `options` arguments (both optional).
    Can be used with single `options` argument, if it contains `type` property.
    
    @option type: String = 'yandex#map'
    The same as `type` argument.
    johndoe committed Jun 10, 2019
    Configuration menu
    Copy the full SHA
    47ebb63 View commit details
    Browse the repository at this point in the history

Commits on Jun 28, 2019

  1. L.Yandex: update examples/yandex.html

    * enhance sample code
    * upgrade to use latest leaflet
    * upgrade to https
    johndoe committed Jun 28, 2019
    Configuration menu
    Copy the full SHA
    6dba910 View commit details
    Browse the repository at this point in the history
  2. L.Yandex: remove unused stuff

    * L.Layer is already inherited from L.Evented
      As for L.Mixin.Events, then we do not support Leaflet 0.x
    
    * actual max available zoom level is 19
    
    * _insertAtBottom, _limitedUpdate: was not used
    
    * getAttribution is already in L.Layer
    
    * _reset contains _initContainer, which already called in onAdd
       And as we already have container, it makes no sense to check it on 'viewreset'
    
    * setOpacity: no need to expose it
    
    * setElementSize: is excessive, as css '100%' is to follow map resize.
    
    * undefined is same as false in conditions
    
    * consistent curly braces usage and other minor style issues
    johndoe committed Jun 28, 2019
    Configuration menu
    Copy the full SHA
    92bd641 View commit details
    Browse the repository at this point in the history
  3. L.Yandex: fix zoom limits not being applied

    johndoe committed Jun 28, 2019
    Configuration menu
    Copy the full SHA
    cee5093 View commit details
    Browse the repository at this point in the history
  4. L.Yandex: fix exception in _update when layer was removed before ym…

    …aps initialized
    johndoe committed Jun 28, 2019
    Configuration menu
    Copy the full SHA
    d6c1199 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    bff9e98 View commit details
    Browse the repository at this point in the history
  6. L.Yandex: refactor; simplify overlay API

    * remove overlay option, it's now controlled by 'overlay' map type
      - opacity for overlay is handled automatically
        but (for compatibility reasons) `opacity` option is still able to override default value
      - background is now transparent for all map types, but this can be canceled by `background` option
    
    * simplify map type handling
      Note: 'publicMap' and 'publicMapHybrid' are valid map types,
      but currently they are identical to 'map' and 'hybrid'
    johndoe committed Jun 28, 2019
    Configuration menu
    Copy the full SHA
    41925ad View commit details
    Browse the repository at this point in the history
  7. L.Yandex: upgrade to ymaps JSAPI 2.1

    * JSAPI 2.0 is not supported anymore.
      It would need complex handling to keep it working with both api sets.
    
    * Simplify `_initMapObject` as new api is able to auto-load required modules
    
    * replace `traffic` option with `trafficControl`
    
    * add `mapOptions` option: https://tech.yandex.com/maps/doc/jsapi/2.1/ref/reference/Map-docpage/#Map__param-options
      Refs:
        https://tech.yandex.ru/maps/jsapi/doc/2.1/ref/reference/Map-docpage/#Map__param-options.suppressMapOpenBlock
        https://tech.yandex.com/maps/jsapi/doc/2.1/ref/reference/Map-docpage/#Map__param-options.yandexMapDisablePoiInteractivity
        https://tech.yandex.com/maps/jsapi/doc/2.1/ref/reference/Balloon-docpage/#Balloon__param-options.autoPan
        auto pan should be disabled to prevent uncoordinated layers offset (or we may just disable poi interactivity to avoid balloon handling)
    
    * add two new map types to cover all existing layer types (see ymaps.layer.storage)
    
    ---
    @Class L.Yandex
    @inherits L.Layer
    Used to load and display tile layers on the map using Yandex JSAPI 2.1
    https://tech.yandex.com/maps/doc/jsapi/2.1/quick-start/index-docpage/
    
    @example
    
    ```js
    L.yandex('yandex#satellite'}).addTo(map);
    ```
    
    @section Map type
    @example
    
    Possible basemap types: `yandex#map`, `yandex#satellite`, `yandex#hybrid`, `yandex#map~vector`
    or their short names: `map`, `satellite`, `hybrid`, `map~vector`
    
    Possible overlay types:
    `overlay` - empty transparent map, which can be used for displaying data provided e.g. by controls.
    `skeleton` - roads and labels, like in `hybrid` (but w/o basemap).
    
    @event MapObjectInitialized: Event
    Fired after Yandex map object is initialized.
    Event listener receives object containing `mapObject` property.
    
    @option mapOptions: Object (see in sources)
    Options to set on map creation:
    https://tech.yandex.com/maps/doc/jsapi/2.1/ref/reference/Map-docpage/#Map__param-options
    
    @option overlayOpacity: Number = 0.8
    Opacity used for map type `overlay`.
    
    @option opacity: Number = undefined
    Force map opacity to given value.
    Not really useful, but kept for compatibility.
    johndoe committed Jun 28, 2019
    Configuration menu
    Copy the full SHA
    5b4c359 View commit details
    Browse the repository at this point in the history

Commits on Jun 29, 2019

  1. L.Yandex: do not try to override controls panel margins

    It's bad practice, and may conflict with other leaflet controls, css, and actual developer intentions.
    And it even do not work in some cases, e.g. when 2 yandex layers added, and then remove 1.
    
    Besides, we do not need two attribution controls anyway (and it looks ugly).
    It'd be better to gather all info in 1 (either Yandex's, either Leaflet's), and there is API for this.
    
    Choosing appropriate decision is up on developer now.
    If he want to change margins - let him do this explicitely.
    And there are plenty of other options, among them:
    - move attribution control to other corner
    - disable attribution control completely
    - implement dynamic attribution fetching from one control to another
    johndoe committed Jun 29, 2019
    Configuration menu
    Copy the full SHA
    7e38817 View commit details
    Browse the repository at this point in the history
  2. L.Yandex: fix z-order of overlay

    Previously overlay was positioned over map pane, and this prevented normal
    interaction with features (like markers, popups, etc).
    
    Correct z-order can be provided only if overlay belongs to same stacking context
    as the rest of panes, thats why we have to make it descendant of leaflet-map-pane.
    
    But as map pane is panning on drag, it's now necessary to update ymaps offset in opposite order
    to fit into visible window.
    
    ---
    Note, that currently ymaps controls/copyrights belong to the rest of layer:
    - positioned *behind* leaflet controls / features
    - moving along with ground (tile) layer on drag
      (not an issue when updating is fast)
    
    It's possible to fix it, if we divide ymaps panes into different containers.
    That could lead to other issues thought..
    So let it as is for now.
    johndoe committed Jun 29, 2019
    Configuration menu
    Copy the full SHA
    d17ad29 View commit details
    Browse the repository at this point in the history
  3. L.Yandex: implement zoom animation

    johndoe committed Jun 29, 2019
    Configuration menu
    Copy the full SHA
    3d402ac View commit details
    Browse the repository at this point in the history

Commits on Jun 30, 2019

  1. L.Yandex: animate movable panes only

    ymaps controls and copyrights shouldn't animate
    
    Note: we need to ensure that 'leaflet-zoom-animated' class is set,
    as more panes can be added in runtime
    johndoe committed Jun 30, 2019
    Configuration menu
    Copy the full SHA
    ca1991b View commit details
    Browse the repository at this point in the history
  2. L.Yandex: extra error protection

    * prevent container removing in onRemove until api initialized.
      ymaps API currently expecting DOM element (to support IE).
      Other browsers also affected when load param mode=debug
      https://tech.yandex.com/maps/jsapi/doc/2.1/dg/concepts/load-docpage/#load__param
    
    * prevent repeated map object initialization when layer removed/added before api is initialized
      onAdd / _initContainer refactored
    johndoe committed Jun 30, 2019
    Configuration menu
    Copy the full SHA
    3337e01 View commit details
    Browse the repository at this point in the history
  3. L.Yandex: clean up on map unload

    For optimization purposes L.Yandex does not destroy itself onRemove (like simple tile layers do)
    But it's still better to clean up on map unload
    johndoe committed Jun 30, 2019
    Configuration menu
    Copy the full SHA
    41a0c7e View commit details
    Browse the repository at this point in the history
  4. L.Yandex: refactor: rename event; get rid of unneeded css classes/id

    * _container.id is not set anymore
    *  leaflet-map-pane class is not set anymore
    * `MapObjectInitialized` is renamed to more typical `load` event
      `mapObject` property is removed, as it's available as `target._yandex`
    
    ---
    @event load: Event
    Fired after Yandex map object is initialized.
    johndoe committed Jun 30, 2019
    Configuration menu
    Copy the full SHA
    8f0e877 View commit details
    Browse the repository at this point in the history
  5. L.Yandex: remove trafficControl support, as traffic layer can be adde…

    …d using ymaps JSAPI directly
    
    usage sample provided in yandex.html
    (it's also example of 'load' event usage)
    johndoe committed Jun 30, 2019
    Configuration menu
    Copy the full SHA
    d89163e View commit details
    Browse the repository at this point in the history
  6. L.Yandex: add sample for adding some Yandex controls (incl. trafficCo…

    …ntrol), via ymaps JSAPI
    
    see yandex-controls.html
    johndoe committed Jun 30, 2019
    Configuration menu
    Copy the full SHA
    ef02f04 View commit details
    Browse the repository at this point in the history
  7. L.Yandex: implement Yandex.addon.Controls.js

    This addon allows using of Yandex controls just specify them in options,
    without direct ymaps JSAPI calls.
    
    see yandex-addon-controls.html (functionality is the same as in yandex-controls.html)
    johndoe committed Jun 30, 2019
    Configuration menu
    Copy the full SHA
    c4dc895 View commit details
    Browse the repository at this point in the history
  8. L.Yandex: add _resyncView method

    It's function is opposite to `_update`: resync center/zoom back from _yandex to map.
    
    Intended to use in (upcoming) addons
    (L.Yandex itself currently does not use it internally)
    johndoe committed Jun 30, 2019
    Configuration menu
    Copy the full SHA
    3d389cf View commit details
    Browse the repository at this point in the history
  9. L.Yandex: implement Yandex.addon.Panorama.js

    Purpose: to integrate panoramas player with leaflet map, avoiding controls conflicts.
    It's function is to take player out of map and put it into separate element.
    
    see yandex-addon-panorama.html
    johndoe committed Jun 30, 2019
    Configuration menu
    Copy the full SHA
    88e994a View commit details
    Browse the repository at this point in the history
  10. L.Yandex: implement Yandex.addon.Fullscreen.js

    Purpose: enable standard Yandex map controls/behaviors in fullscreen.
    
    see yandex-addon-fullscreen.html
    johndoe committed Jun 30, 2019
    Configuration menu
    Copy the full SHA
    f2fc908 View commit details
    Browse the repository at this point in the history
  11. L.Yandex: new sample yandex-kml-gpx.html

    johndoe committed Jun 30, 2019
    Configuration menu
    Copy the full SHA
    acc326e View commit details
    Browse the repository at this point in the history
  12. L.Yandex: minor refactoring: all events set only after ymaps api init…

    …ialized
    johndoe committed Jun 30, 2019
    Configuration menu
    Copy the full SHA
    67c9abb View commit details
    Browse the repository at this point in the history

Commits on Jul 2, 2019

  1. L.Yandex: implement Yandex.addon.LoadApi.js

    It's purpose is dynamic/deferred runtime API enabling.
    
    Yandex.js: _initApi method for extending in addon
    
    See examples/yandex-addon-loadapi-*.html
    
    Another sample loader function similar to used in https://gitlab.com/IvanSanchez/Leaflet.GridLayer.GoogleMutant/:
    
    ```
     	function apiLoader() {
    		return new Promise(function (resolve, reject) {
    			var timer = setInterval(function () {
    				if (typeof ymaps !== 'undefined') {
    					resolve();
    				} else if (counter<10) {
    					counter++; return;
    				} else {
    					reject('API is not available');
    				}
    				clearInterval(timer);
    			}, 500);
    		});
    	}
    ```
    johndoe committed Jul 2, 2019
    Configuration menu
    Copy the full SHA
    ed47982 View commit details
    Browse the repository at this point in the history

Commits on Jul 10, 2019

  1. L.Yandex: add documentation

    johndoe committed Jul 10, 2019
    Configuration menu
    Copy the full SHA
    dce2d3d View commit details
    Browse the repository at this point in the history