Compare commits

..

6 Commits

Author SHA1 Message Date
ahocevar
349e602ee5 Update package version to 5.0.3 2018-07-11 11:01:34 +02:00
ahocevar
9cb10efe4b Changelog for v5.0.3 2018-07-11 10:56:05 +02:00
Andreas Hocevar
871a283601 Merge pull request #8364 from ahocevar/ie-examples
Make examples work in IE11
2018-07-11 10:51:08 +02:00
Andreas Hocevar
d1a609e0a3 Merge pull request #8363 from ahocevar/package-json-autogenerate
Autogenerate src/ol/package.json
2018-07-11 10:49:43 +02:00
Andreas Hocevar
e0c5529878 Merge pull request #8371 from ahocevar/empty-replay-groups
Skip rendering when there is no replay group
2018-07-11 10:47:42 +02:00
ahocevar
59c3eedbab Updates for v5.0.2 2018-07-05 00:04:32 +02:00
40 changed files with 169 additions and 158 deletions

View File

@@ -1,9 +1,8 @@
<!--
Thank you for your interest in making OpenLayers better!
If you are reporting a bug, please link to an example that reproduces the problem. This will make it easier for people who may want to help you debug.
To keep this project manageable for maintainers, we ask you to please check all boxes below before submitting an issue.
If you have a usage question, you might want to try Stack Overflow first: https://stackoverflow.com/questions/tagged/openlayers
Thanks
-->
- [ ] I am submitting a bug or feature request, not a usage question. Go to https://stackoverflow.com/questions/tagged/openlayers for questions.
- [ ] I have searched GitHub to see if a similar bug or feature request has already been reported.
- [ ] I have verified that the issue is present in the latest version of OpenLayers (see 'LATEST' on https://openlayers.org/).
- [ ] If reporting a bug, I have created a [CodePen](https://codepen.io) or prepared a stack trace (using the latest version and unminified code, so e.g. `ol-debug.js`, not `ol.js`) that shows the issue.

View File

@@ -1,13 +1,8 @@
<!--
Thank you for your interest in making OpenLayers better!
Before submitting a pull request, it is best to open an issue describing the bug you are fixing or the feature you are proposing to add.
In order to get your proposed changes merged into the master branch, we ask you to please make sure the following boxes are checked *before* submitting your pull request.
Here are some other tips that make pull requests easier to review:
* Commits in the branch are small and logically separated (with no unnecessary merge commits).
* Commit messages are clear.
* Existing tests pass, new functionality is covered by new tests, and fixes have regression tests.
Thanks
-->
- [ ] This pull request addresses an issue that has been marked with the 'Pull request accepted' label & I have added the link to that issue.
- [ ] It contains one or more small, incremental, logically separate commits, with no merge commits.
- [ ] I have used clear commit messages.
- [ ] Existing tests pass for me locally & I have added or updated tests for new or changed functionality.

1
.gitignore vendored
View File

@@ -3,3 +3,4 @@
/dist/
node_modules/
src/index.js
src/ol/package.json

7
changelog/v5.0.2.md Normal file
View File

@@ -0,0 +1,7 @@
# 5.0.2
The v5.0.1 release updates the package readme with new example projects.
## Fixes
* [#8332](https://github.com/openlayers/openlayers/pull/8343) - Starter projects ([@tschaub](https://github.com/tschaub))

9
changelog/v5.0.3.md Normal file
View File

@@ -0,0 +1,9 @@
# 5.0.3
The v5.0.3 fixes a regression in the vector tile renderer and improves the built examples and release package.
## Fixes
* [#8364](https://github.com/openlayers/openlayers/pull/8364) - Make examples work in IE11 ([@ahocevar](https://github.com/ahocevar))
* [#8363](https://github.com/openlayers/openlayers/pull/8363) - Autogenerate src/ol/package.json ([@ahocevar](https://github.com/ahocevar))
* [#8371](https://github.com/openlayers/openlayers/pull/8371) - Skip rendering when there is no replay group ([@ahocevar](https://github.com/ahocevar))

View File

@@ -18,6 +18,18 @@ module.exports = {
context: src,
target: 'web',
entry: entry,
module: {
rules: [{
use: {
loader: 'buble-loader'
},
test: /\.js$/,
include: [
path.join(__dirname, '..', '..', 'src'),
path.join(__dirname, '..')
]
}]
},
optimization: {
runtimeChunk: {
name: 'common'

View File

@@ -64,20 +64,20 @@ function createWordIndex(exampleData) {
/**
* Gets the source for the chunk that matches the jsPath
* @param {Object} chunk Chunk.
* @param {string} jsPath Path of the file.
* @param {string} jsName Name of the file.
* @return {string} The source.
*/
function getJsSource(chunk, jsPath) {
function getJsSource(chunk, jsName) {
let jsSource;
for (let i = 0, ii = chunk.modules.length; i < ii; ++i) {
const module = chunk.modules[i];
if (module.modules) {
jsSource = getJsSource(module, jsPath);
jsSource = getJsSource(module, jsName);
if (jsSource) {
return jsSource;
}
}
if (module.identifier == jsPath) {
if (module.identifier.endsWith(jsName)) {
return module.source;
}
}
@@ -151,8 +151,7 @@ ExampleBuilder.prototype.render = async function(dir, chunk) {
// add in script tag
const jsName = `${name}.js`;
const jsPath = path.join(dir, jsName);
let jsSource = getJsSource(chunk, jsPath);
let jsSource = getJsSource(chunk, path.join('.', jsName));
jsSource = jsSource.replace(/'\.\.\/src\//g, '\'');
if (data.cloak) {
for (const entry of data.cloak) {

View File

@@ -1,6 +1,6 @@
{
"name": "openlayers",
"version": "5.0.1",
"version": "5.0.3",
"description": "OpenLayers mapping library",
"keywords": [
"map",
@@ -16,9 +16,9 @@
"serve-examples": "webpack-dev-server --config examples/webpack/config.js --mode development --watch",
"build-examples": "webpack --config examples/webpack/config.js --mode production",
"build-index": "node tasks/generate-index",
"set-version": "node tasks/set-version",
"prebuild": "npm run set-version && npm run build-index",
"prepare": "npm run set-version",
"prepare-package": "node tasks/prepare-package",
"prebuild": "npm run prepare-package && npm run build-index",
"prepare": "npm run prepare-package",
"build": "rollup --config config/rollup.js && cleancss --source-map src/ol/ol.css -o build/ol.css",
"presrc-closure": "npm run prebuild",
"src-closure": "node tasks/transform-types",
@@ -35,10 +35,6 @@
"bugs": {
"url": "https://github.com/openlayers/openlayers/issues"
},
"browser": "dist/ol.js",
"style": [
"css/ol.css"
],
"dependencies": {
"pbf": "3.1.0",
"pixelworks": "1.1.0",
@@ -47,6 +43,7 @@
"devDependencies": {
"babel-core": "^6.26.3",
"babel-plugin-jsdoc-closure": "1.5.1",
"buble-loader": "^0.5.1",
"chaikin-smooth": "^1.0.4",
"clean-css-cli": "4.1.11",
"copy-webpack-plugin": "^4.4.1",
@@ -75,8 +72,8 @@
"mustache": "^2.3.0",
"pixelmatch": "^4.0.2",
"proj4": "2.4.4",
"recast": "0.15.1",
"rollup": "0.62.0",
"recast": "0.15.0",
"rollup": "0.61.2",
"rollup-plugin-buble": "0.19.2",
"rollup-plugin-commonjs": "9.1.3",
"rollup-plugin-node-resolve": "3.3.0",
@@ -86,8 +83,8 @@
"uglifyjs-webpack-plugin": "^1.2.5",
"url-polyfill": "^1.0.13",
"walk": "^2.3.9",
"webpack": "4.14.0",
"webpack-cli": "^3.0.3",
"webpack": "4.15.1",
"webpack-cli": "^3.0.8",
"webpack-dev-server": "^3.1.4"
},
"eslintConfig": {

View File

@@ -50,7 +50,7 @@ const ImageWrapper = function(extent, resolution, pixelRatio, src, crossOrigin,
/**
* @private
* @type {HTMLCanvasElement|HTMLImageElement|HTMLVideoElement}
* @type {HTMLCanvasElement|Image|HTMLVideoElement}
*/
this.image_ = new Image();
if (crossOrigin !== null) {
@@ -139,7 +139,7 @@ ImageWrapper.prototype.load = function() {
/**
* @param {HTMLCanvasElement|HTMLImageElement|HTMLVideoElement} image Image.
* @param {HTMLCanvasElement|Image|HTMLVideoElement} image Image.
*/
ImageWrapper.prototype.setImage = function(image) {
this.image_ = image;

View File

@@ -65,7 +65,7 @@ ImageBase.prototype.getExtent = function() {
/**
* @abstract
* @return {HTMLCanvasElement|HTMLImageElement|HTMLVideoElement} Image.
* @return {HTMLCanvasElement|Image|HTMLVideoElement} Image.
*/
ImageBase.prototype.getImage = function() {};

View File

@@ -44,7 +44,7 @@ const ImageTile = function(tileCoord, state, src, crossOrigin, tileLoadFunction,
/**
* @private
* @type {HTMLImageElement|HTMLCanvasElement}
* @type {Image|HTMLCanvasElement}
*/
this.image_ = new Image();
if (crossOrigin !== null) {

View File

@@ -15,7 +15,7 @@ import {containsExtent} from './extent.js';
* @typedef {Object} Options
* @property {number|string} [id] Set the overlay id. The overlay id can be used
* with the {@link module:ol/Map~Map#getOverlayById} method.
* @property {HTMLElement} [element] The overlay element.
* @property {Element} [element] The overlay element.
* @property {Array.<number>} [offset=[0, 0]] Offsets in pixels used when positioning
* the overlay. The first element in the
* array is the horizontal offset. A positive value shifts the overlay right.
@@ -129,7 +129,7 @@ const Overlay = function(options) {
/**
* @protected
* @type {HTMLElement}
* @type {Element}
*/
this.element = document.createElement('DIV');
this.element.className = options.className !== undefined ?
@@ -218,12 +218,12 @@ inherits(Overlay, BaseObject);
/**
* Get the DOM element of this overlay.
* @return {HTMLElement|undefined} The Element containing the overlay.
* @return {Element|undefined} The Element containing the overlay.
* @observable
* @api
*/
Overlay.prototype.getElement = function() {
return /** @type {HTMLElement|undefined} */ (this.get(Property.ELEMENT));
return /** @type {Element|undefined} */ (this.get(Property.ELEMENT));
};
@@ -364,7 +364,7 @@ Overlay.prototype.handlePositioningChanged = function() {
/**
* Set the DOM element to be associated with this overlay.
* @param {HTMLElement|undefined} element The Element containing the overlay.
* @param {Element|undefined} element The Element containing the overlay.
* @observable
* @api
*/
@@ -422,7 +422,7 @@ Overlay.prototype.panIntoView = function() {
}
const mapRect = this.getRect(map.getTargetElement(), map.getSize());
const element = this.getElement();
const element = /** @type {!Element} */ (this.getElement());
const overlayRect = this.getRect(element, [outerWidth(element), outerHeight(element)]);
const margin = this.autoPanMargin;
@@ -469,7 +469,7 @@ Overlay.prototype.panIntoView = function() {
/**
* Get the extent of an element relative to the document
* @param {HTMLElement|undefined} element The element.
* @param {Element|undefined} element The element.
* @param {module:ol/size~Size|undefined} size The size of the element.
* @return {module:ol/extent~Extent} The extent.
* @protected

View File

@@ -76,7 +76,7 @@ import {create as createTransform, apply as applyTransform} from './transform.js
* @typedef {Object} MapOptionsInternal
* @property {module:ol/Collection.<module:ol/control/Control>} [controls]
* @property {module:ol/Collection.<module:ol/interaction/Interaction>} [interactions]
* @property {HTMLElement|Document} keyboardEventTarget
* @property {Element|Document} keyboardEventTarget
* @property {module:ol/Collection.<module:ol/Overlay>} overlays
* @property {Object.<string, *>} values
*/
@@ -93,7 +93,7 @@ import {create as createTransform, apply as applyTransform} from './transform.js
* @property {module:ol/Collection.<module:ol/interaction/Interaction>|Array.<module:ol/interaction/Interaction>} [interactions]
* Interactions that are initially added to the map. If not specified,
* {@link module:ol/interaction~defaults} is used.
* @property {HTMLElement|Document|string} [keyboardEventTarget] The element to
* @property {Element|Document|string} [keyboardEventTarget] The element to
* listen to keyboard events on. This determines when the `KeyboardPan` and
* `KeyboardZoom` interactions trigger. For example, if this option is set to
* `document` the keyboard interactions will always trigger. If this option is
@@ -120,7 +120,7 @@ import {create as createTransform, apply as applyTransform} from './transform.js
* Increasing this value can make it easier to click on the map.
* @property {module:ol/Collection.<module:ol/Overlay>|Array.<module:ol/Overlay>} [overlays]
* Overlays initially added to the map. By default, no overlays are added.
* @property {HTMLElement|string} [target] The container for the map, either the
* @property {Element|string} [target] The container for the map, either the
* element itself or the `id` of the element. If not specified at construction
* time, {@link module:ol/Map~Map#setTarget} must be called for the map to be
* rendered.
@@ -240,7 +240,7 @@ const PluggableMap = function(options) {
/**
* @private
* @type {!HTMLElement}
* @type {Element}
*/
this.viewport_ = document.createElement('DIV');
this.viewport_.className = 'ol-viewport' + (TOUCH ? ' ol-touch' : '');
@@ -254,7 +254,7 @@ const PluggableMap = function(options) {
/**
* @private
* @type {!HTMLElement}
* @type {!Element}
*/
this.overlayContainer_ = document.createElement('DIV');
this.overlayContainer_.className = 'ol-overlaycontainer';
@@ -262,7 +262,7 @@ const PluggableMap = function(options) {
/**
* @private
* @type {!HTMLElement}
* @type {!Element}
*/
this.overlayContainerStopEvent_ = document.createElement('DIV');
this.overlayContainerStopEvent_.className = 'ol-overlaycontainer-stopevent';
@@ -293,7 +293,7 @@ const PluggableMap = function(options) {
/**
* @private
* @type {HTMLElement|Document}
* @type {Element|Document}
*/
this.keyboardEventTarget_ = optionsInternal.keyboardEventTarget;
@@ -685,13 +685,13 @@ PluggableMap.prototype.getEventPixel = function(event) {
* Get the target in which this map is rendered.
* Note that this returns what is entered as an option or in setTarget:
* if that was an element, it returns an element; if a string, it returns that.
* @return {HTMLElement|string|undefined} The Element or id of the Element that the
* @return {Element|string|undefined} The Element or id of the Element that the
* map is rendered in.
* @observable
* @api
*/
PluggableMap.prototype.getTarget = function() {
return /** @type {HTMLElement|string|undefined} */ (this.get(MapProperty.TARGET));
return /** @type {Element|string|undefined} */ (this.get(MapProperty.TARGET));
};
@@ -699,7 +699,7 @@ PluggableMap.prototype.getTarget = function() {
* Get the DOM element into which this map is rendered. In contrast to
* `getTarget` this method always return an `Element`, or `null` if the
* map has no target.
* @return {HTMLElement} The element that the map is rendered in.
* @return {Element} The element that the map is rendered in.
* @api
*/
PluggableMap.prototype.getTargetElement = function() {
@@ -857,7 +857,7 @@ PluggableMap.prototype.getView = function() {
/**
* Get the element that serves as the map viewport.
* @return {HTMLElement} Viewport.
* @return {Element} Viewport.
* @api
*/
PluggableMap.prototype.getViewport = function() {
@@ -870,7 +870,7 @@ PluggableMap.prototype.getViewport = function() {
* this container will let mousedown and touchstart events through to the map,
* so clicks and gestures on an overlay will trigger {@link module:ol/MapBrowserEvent~MapBrowserEvent}
* events.
* @return {!HTMLElement} The map's overlay container.
* @return {!Element} The map's overlay container.
*/
PluggableMap.prototype.getOverlayContainer = function() {
return this.overlayContainer_;
@@ -882,7 +882,7 @@ PluggableMap.prototype.getOverlayContainer = function() {
* event propagation. Elements added to this container won't let mousedown and
* touchstart events through to the map, so clicks and gestures on an overlay
* don't trigger any {@link module:ol/MapBrowserEvent~MapBrowserEvent}.
* @return {!HTMLElement} The map's overlay container that stops events.
* @return {!Element} The map's overlay container that stops events.
*/
PluggableMap.prototype.getOverlayContainerStopEvent = function() {
return this.overlayContainerStopEvent_;
@@ -1322,7 +1322,7 @@ PluggableMap.prototype.setSize = function(size) {
/**
* Set the target element to render this map into.
* @param {HTMLElement|string|undefined} target The Element or id of the Element
* @param {Element|string|undefined} target The Element or id of the Element
* that the map is rendered in.
* @observable
* @api
@@ -1398,7 +1398,7 @@ PluggableMap.prototype.unskipFeature = function(feature) {
function createOptionsInternal(options) {
/**
* @type {HTMLElement|Document}
* @type {Element|Document}
*/
let keyboardEventTarget = null;
if (options.keyboardEventTarget !== undefined) {

View File

@@ -256,7 +256,7 @@ Attribution.prototype.updateElement_ = function(frameState) {
/**
* @param {MouseEvent} event The event to handle
* @param {Event} event The event to handle
* @private
*/
Attribution.prototype.handleClick_ = function(event) {

View File

@@ -136,7 +136,7 @@ inherits(FullScreen, Control);
/**
* @param {MouseEvent} event The event to handle
* @param {Event} event The event to handle
* @private
*/
FullScreen.prototype.handleClick_ = function(event) {

View File

@@ -498,7 +498,7 @@ OverviewMap.prototype.calculateCoordinateRotate_ = function(
/**
* @param {MouseEvent} event The event to handle
* @param {Event} event The event to handle
* @private
*/
OverviewMap.prototype.handleClick_ = function(event) {

View File

@@ -113,7 +113,7 @@ inherits(Rotate, Control);
/**
* @param {MouseEvent} event The event to handle
* @param {Event} event The event to handle
* @private
*/
Rotate.prototype.handleClick_ = function(event) {

View File

@@ -72,14 +72,14 @@ const ScaleLine = function(opt_options) {
/**
* @private
* @type {HTMLElement}
* @type {Element}
*/
this.innerElement_ = document.createElement('DIV');
this.innerElement_.className = className + '-inner';
/**
* @private
* @type {HTMLElement}
* @type {Element}
*/
this.element_ = document.createElement('DIV');
this.element_.className = className + ' ' + CLASS_UNSELECTABLE;

View File

@@ -98,7 +98,7 @@ inherits(Zoom, Control);
/**
* @param {number} delta Zoom delta.
* @param {MouseEvent} event The event to handle
* @param {Event} event The event to handle
* @private
*/
Zoom.prototype.handleClick_ = function(delta, event) {

View File

@@ -227,7 +227,7 @@ export function render(mapEvent) {
/**
* @param {MouseEvent} event The browser event to handle.
* @param {Event} event The browser event to handle.
* @private
*/
ZoomSlider.prototype.handleContainerClick_ = function(event) {

View File

@@ -68,7 +68,7 @@ inherits(ZoomToExtent, Control);
/**
* @param {MouseEvent} event The event to handle
* @param {Event} event The event to handle
* @private
*/
ZoomToExtent.prototype.handleClick_ = function(event) {

View File

@@ -25,7 +25,7 @@ export function createCanvasContext2D(opt_width, opt_height) {
* Get the current computed width for the given element including margin,
* padding and border.
* Equivalent to jQuery's `$(el).outerWidth(true)`.
* @param {!HTMLElement} element Element.
* @param {!Element} element Element.
* @return {number} The width.
*/
export function outerWidth(element) {
@@ -41,7 +41,7 @@ export function outerWidth(element) {
* Get the current computed height for the given element including margin,
* padding and border.
* Equivalent to jQuery's `$(el).outerHeight(true)`.
* @param {!HTMLElement} element Element.
* @param {!Element} element Element.
* @return {number} The height.
*/
export function outerHeight(element) {

View File

@@ -12,7 +12,7 @@ const NAMESPACE_URI = 'http://www.w3.org/1999/xlink';
/**
* @param {Node} node Node.
* @return {string|undefined} href.
* @return {boolean|undefined} Boolean.
*/
export function readHref(node) {
return node.getAttributeNS(NAMESPACE_URI, 'href');

View File

@@ -1,14 +0,0 @@
{
"name": "ol",
"version": "5.0.1",
"description": "OpenLayers mapping library",
"main": "index.js",
"module": "index.js",
"license": "BSD-2-Clause",
"dependencies": {
"pbf": "3.1.0",
"pixelworks": "1.1.0",
"rbush": "2.0.2"
},
"sideEffects": "false"
}

View File

@@ -106,7 +106,7 @@ const DEDUP_DIST = 25;
* or detect that the positions are invalid.
*
* @private
* @param {MouseEvent} inEvent The in event.
* @param {Event} inEvent The in event.
* @return {boolean} True, if the event was generated by a touch.
*/
MouseSource.prototype.isEventSimulatedFromTouch_ = function(inEvent) {
@@ -154,7 +154,7 @@ function prepareEvent(inEvent, dispatcher) {
/**
* Handler for `mousedown`.
*
* @param {MouseEvent} inEvent The in event.
* @param {Event} inEvent The in event.
*/
MouseSource.prototype.mousedown = function(inEvent) {
if (!this.isEventSimulatedFromTouch_(inEvent)) {
@@ -173,7 +173,7 @@ MouseSource.prototype.mousedown = function(inEvent) {
/**
* Handler for `mousemove`.
*
* @param {MouseEvent} inEvent The in event.
* @param {Event} inEvent The in event.
*/
MouseSource.prototype.mousemove = function(inEvent) {
if (!this.isEventSimulatedFromTouch_(inEvent)) {
@@ -186,7 +186,7 @@ MouseSource.prototype.mousemove = function(inEvent) {
/**
* Handler for `mouseup`.
*
* @param {MouseEvent} inEvent The in event.
* @param {Event} inEvent The in event.
*/
MouseSource.prototype.mouseup = function(inEvent) {
if (!this.isEventSimulatedFromTouch_(inEvent)) {
@@ -204,7 +204,7 @@ MouseSource.prototype.mouseup = function(inEvent) {
/**
* Handler for `mouseover`.
*
* @param {MouseEvent} inEvent The in event.
* @param {Event} inEvent The in event.
*/
MouseSource.prototype.mouseover = function(inEvent) {
if (!this.isEventSimulatedFromTouch_(inEvent)) {
@@ -217,7 +217,7 @@ MouseSource.prototype.mouseover = function(inEvent) {
/**
* Handler for `mouseout`.
*
* @param {MouseEvent} inEvent The in event.
* @param {Event} inEvent The in event.
*/
MouseSource.prototype.mouseout = function(inEvent) {
if (!this.isEventSimulatedFromTouch_(inEvent)) {

View File

@@ -131,7 +131,7 @@ TouchSource.prototype.setPrimaryTouch_ = function(inTouch) {
/**
* @private
* @param {PointerEvent} inPointer The in pointer object.
* @param {Object} inPointer The in pointer object.
*/
TouchSource.prototype.removePrimaryPointer_ = function(inPointer) {
if (inPointer.isPrimary) {
@@ -172,9 +172,9 @@ TouchSource.prototype.cancelResetClickCount_ = function() {
/**
* @private
* @param {TouchEvent} browserEvent Browser event
* @param {Event} browserEvent Browser event
* @param {Touch} inTouch Touch event
* @return {PointerEvent} A pointer object.
* @return {Object} A pointer object.
*/
TouchSource.prototype.touchToPointer_ = function(browserEvent, inTouch) {
const e = this.dispatcher.cloneEvent(browserEvent, inTouch);
@@ -208,8 +208,8 @@ TouchSource.prototype.touchToPointer_ = function(browserEvent, inTouch) {
/**
* @private
* @param {TouchEvent} inEvent Touch event
* @param {function(TouchEvent, PointerEvent)} inFunction In function.
* @param {Event} inEvent Touch event
* @param {function(Event, Object)} inFunction In function.
*/
TouchSource.prototype.processTouches_ = function(inEvent, inFunction) {
const touches = Array.prototype.slice.call(inEvent.changedTouches);
@@ -253,7 +253,7 @@ TouchSource.prototype.findTouch_ = function(touchList, searchId) {
* this "abandoned" touch
*
* @private
* @param {TouchEvent} inEvent The in event.
* @param {Event} inEvent The in event.
*/
TouchSource.prototype.vacuumTouches_ = function(inEvent) {
const touchList = inEvent.touches;
@@ -284,7 +284,7 @@ TouchSource.prototype.vacuumTouches_ = function(inEvent) {
* Handler for `touchstart`, triggers `pointerover`,
* `pointerenter` and `pointerdown` events.
*
* @param {TouchEvent} inEvent The in event.
* @param {Event} inEvent The in event.
*/
TouchSource.prototype.touchstart = function(inEvent) {
this.vacuumTouches_(inEvent);
@@ -297,8 +297,8 @@ TouchSource.prototype.touchstart = function(inEvent) {
/**
* @private
* @param {TouchEvent} browserEvent The event.
* @param {PointerEvent} inPointer The in pointer object.
* @param {Event} browserEvent The event.
* @param {Object} inPointer The in pointer object.
*/
TouchSource.prototype.overDown_ = function(browserEvent, inPointer) {
this.pointerMap[inPointer.pointerId] = {
@@ -315,7 +315,7 @@ TouchSource.prototype.overDown_ = function(browserEvent, inPointer) {
/**
* Handler for `touchmove`.
*
* @param {TouchEvent} inEvent The in event.
* @param {Event} inEvent The in event.
*/
TouchSource.prototype.touchmove = function(inEvent) {
inEvent.preventDefault();
@@ -325,8 +325,8 @@ TouchSource.prototype.touchmove = function(inEvent) {
/**
* @private
* @param {TouchEvent} browserEvent The event.
* @param {PointerEvent} inPointer The in pointer.
* @param {Event} browserEvent The event.
* @param {Object} inPointer The in pointer.
*/
TouchSource.prototype.moveOverOut_ = function(browserEvent, inPointer) {
const event = inPointer;
@@ -362,7 +362,7 @@ TouchSource.prototype.moveOverOut_ = function(browserEvent, inPointer) {
* Handler for `touchend`, triggers `pointerup`,
* `pointerout` and `pointerleave` events.
*
* @param {TouchEvent} inEvent The event.
* @param {Event} inEvent The event.
*/
TouchSource.prototype.touchend = function(inEvent) {
this.dedupSynthMouse_(inEvent);
@@ -372,8 +372,8 @@ TouchSource.prototype.touchend = function(inEvent) {
/**
* @private
* @param {TouchEvent} browserEvent An event.
* @param {PointerEvent} inPointer The inPointer object.
* @param {Event} browserEvent An event.
* @param {Object} inPointer The inPointer object.
*/
TouchSource.prototype.upOut_ = function(browserEvent, inPointer) {
this.dispatcher.up(inPointer, browserEvent);
@@ -387,7 +387,7 @@ TouchSource.prototype.upOut_ = function(browserEvent, inPointer) {
* Handler for `touchcancel`, triggers `pointercancel`,
* `pointerout` and `pointerleave` events.
*
* @param {TouchEvent} inEvent The in event.
* @param {Event} inEvent The in event.
*/
TouchSource.prototype.touchcancel = function(inEvent) {
this.processTouches_(inEvent, this.cancelOut_);
@@ -396,8 +396,8 @@ TouchSource.prototype.touchcancel = function(inEvent) {
/**
* @private
* @param {TouchEvent} browserEvent The event.
* @param {PointerEvent} inPointer The in pointer.
* @param {Event} browserEvent The event.
* @param {Object} inPointer The in pointer.
*/
TouchSource.prototype.cancelOut_ = function(browserEvent, inPointer) {
this.dispatcher.cancel(inPointer, browserEvent);
@@ -409,7 +409,7 @@ TouchSource.prototype.cancelOut_ = function(browserEvent, inPointer) {
/**
* @private
* @param {PointerEvent} inPointer The inPointer object.
* @param {Object} inPointer The inPointer object.
*/
TouchSource.prototype.cleanUpPointer_ = function(inPointer) {
delete this.pointerMap[inPointer.pointerId];
@@ -421,7 +421,7 @@ TouchSource.prototype.cleanUpPointer_ = function(inPointer) {
* Prevent synth mouse events from creating pointer events.
*
* @private
* @param {TouchEvent} inEvent The in event.
* @param {Event} inEvent The in event.
*/
TouchSource.prototype.dedupSynthMouse_ = function(inEvent) {
const lts = this.mouseSource.lastTouches;

View File

@@ -45,9 +45,9 @@ import {METERS_PER_UNIT} from '../proj/Units.js';
* urn:ogc:def:crs:EPSG:6.18:3:3857,
* http://www.opengis.net/gml/srs/epsg.xml#3857
*
* If you use [proj4js](https://github.com/proj4js/proj4js), aliases can
* be added using `proj4.defs()`. After all required projection definitions are
* added, call the {@link module:ol/proj/proj4~register} function.
* If you use proj4js, aliases can be added using `proj4.defs()`; see
* [documentation](https://github.com/proj4js/proj4js). To set an alternative
* namespace for proj4, use {@link module:ol/proj~setProj4}.
*
* @constructor
* @param {module:ol/proj/Projection~Options} options Projection options.

View File

@@ -29,13 +29,13 @@ const CanvasImageReplay = function(
/**
* @private
* @type {HTMLCanvasElement|HTMLVideoElement|HTMLImageElement}
* @type {HTMLCanvasElement|HTMLVideoElement|Image}
*/
this.hitDetectionImage_ = null;
/**
* @private
* @type {HTMLCanvasElement|HTMLVideoElement|HTMLImageElement}
* @type {HTMLCanvasElement|HTMLVideoElement|Image}
*/
this.image_ = null;

View File

@@ -100,7 +100,7 @@ const CanvasImmediateRenderer = function(context, pixelRatio, extent, transform,
/**
* @private
* @type {HTMLCanvasElement|HTMLVideoElement|HTMLImageElement}
* @type {HTMLCanvasElement|HTMLVideoElement|Image}
*/
this.image_ = null;

View File

@@ -652,7 +652,7 @@ CanvasReplay.prototype.replay_ = function(
case CanvasInstruction.DRAW_IMAGE:
d = /** @type {number} */ (instruction[1]);
dd = /** @type {number} */ (instruction[2]);
image = /** @type {HTMLCanvasElement|HTMLVideoElement|HTMLImageElement} */
image = /** @type {HTMLCanvasElement|HTMLVideoElement|Image} */
(instruction[3]);
// Remaining arguments in DRAW_IMAGE are in alphabetical order
anchorX = /** @type {number} */ (instruction[4]);

View File

@@ -83,7 +83,7 @@ IntermediateCanvasRenderer.prototype.composeFrame = function(frameState, layerSt
/**
* @abstract
* @return {HTMLCanvasElement|HTMLVideoElement|HTMLImageElement} Canvas.
* @return {HTMLCanvasElement|HTMLVideoElement|Image} Canvas.
*/
IntermediateCanvasRenderer.prototype.getImage = function() {};

View File

@@ -392,7 +392,9 @@ CanvasVectorTileLayerRenderer.prototype.postCompose = function(context, frameSta
continue;
}
const replayGroup = sourceTile.getReplayGroup(layer, tileCoord.toString());
if (renderMode != VectorTileRenderType.VECTOR && !replayGroup.hasReplays(replayTypes)) {
if (!replayGroup || !replayGroup.hasReplays(replayTypes)) {
// sourceTile was not yet loaded when this.createReplayGroup_() was
// called, or it has no replays of the types we want to render
continue;
}
if (!transform) {

View File

@@ -84,7 +84,7 @@ function enlargeClipPoint(centroidX, centroidY, x, y) {
* @param {module:ol/reproj/Triangulation} triangulation
* Calculated triangulation.
* @param {Array.<{extent: module:ol/extent~Extent,
* image: (HTMLCanvasElement|HTMLImageElement|HTMLVideoElement)}>} sources
* image: (HTMLCanvasElement|Image|HTMLVideoElement)}>} sources
* Array of sources.
* @param {number} gutter Gutter of the sources.
* @param {boolean=} opt_renderEdges Render reprojection edges.

View File

@@ -80,7 +80,7 @@ inherits(CustomTile, Tile);
/**
* Get the image element for this tile.
* @return {HTMLImageElement} Image.
* @return {Image} Image.
*/
CustomTile.prototype.getImage = function() {
return null;

View File

@@ -29,7 +29,7 @@ import ImageStyle from '../style/Image.js';
* @property {null|string} [crossOrigin] The `crossOrigin` attribute for loaded images. Note that you must provide a
* `crossOrigin` value if you are using the WebGL renderer or if you want to access pixel data with the Canvas renderer.
* See {@link https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_enabled_image} for more detail.
* @property {HTMLImageElement|HTMLCanvasElement} [img] Image object for the icon. If the `src` option is not provided then the
* @property {Image|HTMLCanvasElement} [img] Image object for the icon. If the `src` option is not provided then the
* provided image must already be loaded. And in that case, it is required
* to provide the size of the image, with the `imgSize` option.
* @property {Array.<number>} [offset=[0, 0]] Offset, which, together with the size and the offset origin, define the
@@ -106,7 +106,7 @@ const Icon = function(opt_options) {
options.crossOrigin !== undefined ? options.crossOrigin : null;
/**
* @type {HTMLImageElement|HTMLCanvasElement}
* @type {Image|HTMLCanvasElement}
*/
const image = options.img !== undefined ? options.img : null;
@@ -299,7 +299,7 @@ Icon.prototype.getColor = function() {
/**
* Get the image icon.
* @param {number} pixelRatio Pixel ratio.
* @return {HTMLImageElement|HTMLCanvasElement} Image or Canvas element.
* @return {Image|HTMLCanvasElement} Image or Canvas element.
* @override
* @api
*/

View File

@@ -11,7 +11,7 @@ import {shared as iconImageCache} from '../style/IconImageCache.js';
/**
* @constructor
* @param {HTMLImageElement|HTMLCanvasElement} image Image.
* @param {Image|HTMLCanvasElement} image Image.
* @param {string|undefined} src Src.
* @param {module:ol/size~Size} size Size.
* @param {?string} crossOrigin Cross origin.
@@ -25,13 +25,13 @@ const IconImage = function(image, src, size, crossOrigin, imageState, color) {
/**
* @private
* @type {HTMLImageElement|HTMLCanvasElement}
* @type {Image|HTMLCanvasElement}
*/
this.hitDetectionImage_ = null;
/**
* @private
* @type {HTMLImageElement|HTMLCanvasElement}
* @type {Image|HTMLCanvasElement}
*/
this.image_ = !image ? new Image() : image;
@@ -92,7 +92,7 @@ inherits(IconImage, EventTarget);
/**
* @param {HTMLImageElement|HTMLCanvasElement} image Image.
* @param {Image|HTMLCanvasElement} image Image.
* @param {string} src Src.
* @param {module:ol/size~Size} size Size.
* @param {?string} crossOrigin Cross origin.
@@ -161,7 +161,7 @@ IconImage.prototype.handleImageLoad_ = function() {
/**
* @param {number} pixelRatio Pixel ratio.
* @return {HTMLImageElement|HTMLCanvasElement} Image or Canvas element.
* @return {Image|HTMLCanvasElement} Image or Canvas element.
*/
IconImage.prototype.getImage = function(pixelRatio) {
return this.canvas_ ? this.canvas_ : this.image_;
@@ -178,7 +178,7 @@ IconImage.prototype.getImageState = function() {
/**
* @param {number} pixelRatio Pixel ratio.
* @return {HTMLImageElement|HTMLCanvasElement} Image element.
* @return {Image|HTMLCanvasElement} Image element.
*/
IconImage.prototype.getHitDetectionImage = function(pixelRatio) {
if (!this.hitDetectionImage_) {

View File

@@ -122,7 +122,7 @@ ImageStyle.prototype.getAnchor = function() {};
* Get the image element for the symbolizer.
* @abstract
* @param {number} pixelRatio Pixel ratio.
* @return {HTMLCanvasElement|HTMLVideoElement|HTMLImageElement} Image element.
* @return {HTMLCanvasElement|HTMLVideoElement|Image} Image element.
*/
ImageStyle.prototype.getImage = function(pixelRatio) {};
@@ -130,7 +130,7 @@ ImageStyle.prototype.getImage = function(pixelRatio) {};
/**
* @abstract
* @param {number} pixelRatio Pixel ratio.
* @return {HTMLCanvasElement|HTMLVideoElement|HTMLImageElement} Image element.
* @return {HTMLCanvasElement|HTMLVideoElement|Image} Image element.
*/
ImageStyle.prototype.getHitDetectionImage = function(pixelRatio) {};

View File

@@ -52,4 +52,4 @@ export function getUid(obj) {
* OpenLayers version.
* @type {string}
*/
export const VERSION = '5.0.1';
export const VERSION = '5.0.3';

27
tasks/prepare-package.js Normal file
View File

@@ -0,0 +1,27 @@
const fs = require('fs');
const path = require('path');
const pkg = require('../package.json');
const util = require.resolve('../src/ol/util');
const lines = fs.readFileSync(util, 'utf-8').split('\n');
const versionRegEx = /const VERSION = '(.*)';$/;
for (let i = 0, ii = lines.length; i < ii; ++i) {
const line = lines[i];
if (versionRegEx.test(line)) {
lines[i] = line.replace(versionRegEx, `const VERSION = '${pkg.version}';`);
break;
}
}
fs.writeFileSync(util, lines.join('\n'), 'utf-8');
const src = path.join('src', 'ol');
const packageJson = path.resolve(__dirname, path.join('..', src, 'package.json'));
delete pkg.scripts;
delete pkg.devDependencies;
delete pkg.style;
delete pkg.eslintConfig;
const main = path.posix.relative(src, require.resolve(path.join('..', pkg.main)));
pkg.main = pkg.module = main;
pkg.name = 'ol';
fs.writeFileSync(packageJson, JSON.stringify(pkg, null, 2), 'utf-8');

View File

@@ -1,23 +0,0 @@
const fs = require('fs');
const pkg = require('../package.json');
const index = require.resolve('../src/ol/util');
const lines = fs.readFileSync(index, 'utf-8').split('\n');
const versionRegEx = /const VERSION = '(.*)';$/;
for (let i = 0, ii = lines.length; i < ii; ++i) {
const line = lines[i];
if (versionRegEx.test(line)) {
lines[i] = line.replace(versionRegEx, `const VERSION = '${pkg.version}';`);
break;
}
}
const packageJson = require.resolve('../src/ol/package.json');
const packageJsonObj = JSON.parse(fs.readFileSync(packageJson, 'utf-8'));
packageJsonObj.version = pkg.version;
fs.writeFileSync(packageJson, JSON.stringify(packageJsonObj, null, 2), 'utf-8');
fs.writeFileSync(index, lines.join('\n'), 'utf-8');