Skip to content

Latest commit

 

History

History
154 lines (143 loc) · 16.5 KB

v3.14.0.md

File metadata and controls

154 lines (143 loc) · 16.5 KB

v3.14.0

Summary

The v3.14.0 release includes features and fixes from 93 pull requests since the v3.13.1 release. New features and improvements include:

  • New source option for the ol.control.FullScreen, to allow including other elements besides the map in a full screen view (#4679).
  • New target property for the Drag&Drop interaction allows using a different drop target than the map viewport (#4876).
  • ol.style.RegularShape has a new rotateWithView option, for controlling how regular shape symbols are rendered on rotated views (#4698).
  • New layers option for ol.format.WMSGetFeatureInfo format, to selectively only read features from specific layers (#4700).
  • New precision parameter for formatting coordinates with ol.coordinate.toStringHDMS (#4787).
  • Smarter tile queue for improved tile loading user experience when more than one tile layer is used (#4794).
  • Improved rendering performance for tile layers by rendering tiles directly to the map canvas (#4597).
  • The goog.events event system was replaced with our own lightweight event system. This significally reduces the build size (#4711). Replacement of other goog.* components with ES5 features or custom code marks a huge step towards the complete removal of the Closure Library dependency.

Upgrade notes

Internet Explorer 9 support

As of this release, OpenLayers requires a requestAnimationFrame/cancelAnimationFrame polyfill for IE 9 support. See https://cdn.polyfill.io/v2/docs/features/#requestAnimationFrame.

Layer pre-/postcompose event changes

It is the responsibility of the application to undo any canvas transform changes at the end of a layer 'precompose' or 'postcompose' handler. Previously, it was ok to set a null transform. The API now guarantees a device pixel coordinate system on the canvas with its origin in the top left corner of the map. However, applications should not rely on the underlying canvas being the same size as the visible viewport.

Old code:

layer.on('precompose', function(e) {
  // rely on canvas dimensions to move coordinate origin to center
  e.context.translate(e.context.canvas.width / 2, e.context.canvas.height / 2);
  e.context.scale(3, 3);
  // draw an x in the center of the viewport
  e.context.moveTo(-20, -20);
  e.context.lineTo(20, 20);
  e.context.moveTo(-20, 20);
  e.context.lineTo(20, -20);
  // rely on the canvas having a null transform
  e.context.setTransform(1, 0, 0, 1, 0, 0);
});

New code:

layer.on('precompose', function(e) {
  // use map size and pixel ratio to move coordinate origin to center
  var size = map.getSize();
  var pixelRatio = e.frameState.pixelRatio;
  e.context.translate(size[0] / 2 * pixelRatio, size[1] / 2 * pixelRatio);
  e.context.scale(3, 3);
  // draw an x in the center of the viewport
  e.context.moveTo(-20, -20);
  e.context.lineTo(20, 20);
  e.context.moveTo(-20, 20);
  e.context.lineTo(20, -20);
  // undo all transforms
  e.context.scale(1 / 3, 1 / 3);
  e.context.translate(-size[0] / 2 * pixelRatio, -size[1] / 2 * pixelRatio);
});

Full list of changes