Updates for TypeScript v4
This commit is contained in:
@@ -140,6 +140,7 @@ class MapBrowserEventHandler extends EventTarget {
|
|||||||
} else {
|
} else {
|
||||||
// click
|
// click
|
||||||
this.clickTimeoutId_ = setTimeout(
|
this.clickTimeoutId_ = setTimeout(
|
||||||
|
/** @this {MapBrowserEventHandler} */
|
||||||
function () {
|
function () {
|
||||||
this.clickTimeoutId_ = undefined;
|
this.clickTimeoutId_ = undefined;
|
||||||
const newEvent = new MapBrowserEvent(
|
const newEvent = new MapBrowserEvent(
|
||||||
|
|||||||
@@ -187,7 +187,7 @@ class PluggableMap extends BaseObject {
|
|||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
this.animationDelay_ = function () {
|
this.animationDelay_ = /** @this {PluggableMap} */ function () {
|
||||||
this.animationDelayKey_ = undefined;
|
this.animationDelayKey_ = undefined;
|
||||||
this.renderFrame_(Date.now());
|
this.renderFrame_(Date.now());
|
||||||
}.bind(this);
|
}.bind(this);
|
||||||
|
|||||||
@@ -109,8 +109,8 @@ import {squaredDistance as squaredCoordinateDistance} from '../coordinate.js';
|
|||||||
* and a projection as arguments, and returns a geometry. The optional existing
|
* and a projection as arguments, and returns a geometry. The optional existing
|
||||||
* geometry is the geometry that is returned when the function is called without
|
* geometry is the geometry that is returned when the function is called without
|
||||||
* a second argument.
|
* a second argument.
|
||||||
* @typedef {function(!SketchCoordType, import("../geom/SimpleGeometry.js").default=,
|
* @typedef {function(!SketchCoordType, import("../geom/SimpleGeometry.js").default,
|
||||||
* import("../proj/Projection.js").default=):
|
* import("../proj/Projection.js").default):
|
||||||
* import("../geom/SimpleGeometry.js").default} GeometryFunction
|
* import("../geom/SimpleGeometry.js").default} GeometryFunction
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -299,13 +299,13 @@ class Draw extends PointerInteraction {
|
|||||||
if (this.type_ === GeometryType.CIRCLE) {
|
if (this.type_ === GeometryType.CIRCLE) {
|
||||||
/**
|
/**
|
||||||
* @param {!LineCoordType} coordinates The coordinates.
|
* @param {!LineCoordType} coordinates The coordinates.
|
||||||
* @param {import("../geom/SimpleGeometry.js").default=} opt_geometry Optional geometry.
|
* @param {import("../geom/SimpleGeometry.js").default|undefined} geometry Optional geometry.
|
||||||
* @param {import("../proj/Projection.js").default} projection The view projection.
|
* @param {import("../proj/Projection.js").default} projection The view projection.
|
||||||
* @return {import("../geom/SimpleGeometry.js").default} A geometry.
|
* @return {import("../geom/SimpleGeometry.js").default} A geometry.
|
||||||
*/
|
*/
|
||||||
geometryFunction = function (coordinates, opt_geometry, projection) {
|
geometryFunction = function (coordinates, geometry, projection) {
|
||||||
const circle = opt_geometry
|
const circle = geometry
|
||||||
? /** @type {Circle} */ (opt_geometry)
|
? /** @type {Circle} */ (geometry)
|
||||||
: new Circle([NaN, NaN]);
|
: new Circle([NaN, NaN]);
|
||||||
const center = fromUserCoordinate(coordinates[0], projection);
|
const center = fromUserCoordinate(coordinates[0], projection);
|
||||||
const squaredLength = squaredCoordinateDistance(
|
const squaredLength = squaredCoordinateDistance(
|
||||||
@@ -331,12 +331,11 @@ class Draw extends PointerInteraction {
|
|||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @param {!LineCoordType} coordinates The coordinates.
|
* @param {!LineCoordType} coordinates The coordinates.
|
||||||
* @param {import("../geom/SimpleGeometry.js").default=} opt_geometry Optional geometry.
|
* @param {import("../geom/SimpleGeometry.js").default|undefined} geometry Optional geometry.
|
||||||
* @param {import("../proj/Projection.js").default} projection The view projection.
|
* @param {import("../proj/Projection.js").default} projection The view projection.
|
||||||
* @return {import("../geom/SimpleGeometry.js").default} A geometry.
|
* @return {import("../geom/SimpleGeometry.js").default} A geometry.
|
||||||
*/
|
*/
|
||||||
geometryFunction = function (coordinates, opt_geometry, projection) {
|
geometryFunction = function (coordinates, geometry, projection) {
|
||||||
let geometry = opt_geometry;
|
|
||||||
if (geometry) {
|
if (geometry) {
|
||||||
if (mode === Mode.POLYGON) {
|
if (mode === Mode.POLYGON) {
|
||||||
if (coordinates[0].length) {
|
if (coordinates[0].length) {
|
||||||
|
|||||||
@@ -338,7 +338,11 @@ class CanvasVectorLayerRenderer extends CanvasLayerRenderer {
|
|||||||
*/
|
*/
|
||||||
getFeatures(pixel) {
|
getFeatures(pixel) {
|
||||||
return new Promise(
|
return new Promise(
|
||||||
function (resolve, reject) {
|
/**
|
||||||
|
* @param {function(Array<import("../../Feature").default|import("../../render/Feature").default>): void} resolve Resolver function.
|
||||||
|
* @this {CanvasVectorLayerRenderer}
|
||||||
|
*/
|
||||||
|
function (resolve) {
|
||||||
if (!this.hitDetectionImageData_ && !this.animatingOrInteracting_) {
|
if (!this.hitDetectionImageData_ && !this.animatingOrInteracting_) {
|
||||||
const size = [this.context.canvas.width, this.context.canvas.height];
|
const size = [this.context.canvas.width, this.context.canvas.height];
|
||||||
apply(this.pixelTransform, size);
|
apply(this.pixelTransform, size);
|
||||||
@@ -622,28 +626,29 @@ class CanvasVectorLayerRenderer extends CanvasLayerRenderer {
|
|||||||
|
|
||||||
const squaredTolerance = getSquaredRenderTolerance(resolution, pixelRatio);
|
const squaredTolerance = getSquaredRenderTolerance(resolution, pixelRatio);
|
||||||
|
|
||||||
/**
|
const render =
|
||||||
* @param {import("../../Feature.js").default} feature Feature.
|
/**
|
||||||
* @this {CanvasVectorLayerRenderer}
|
* @param {import("../../Feature.js").default} feature Feature.
|
||||||
*/
|
* @this {CanvasVectorLayerRenderer}
|
||||||
const render = function (feature) {
|
*/
|
||||||
let styles;
|
function (feature) {
|
||||||
const styleFunction =
|
let styles;
|
||||||
feature.getStyleFunction() || vectorLayer.getStyleFunction();
|
const styleFunction =
|
||||||
if (styleFunction) {
|
feature.getStyleFunction() || vectorLayer.getStyleFunction();
|
||||||
styles = styleFunction(feature, resolution);
|
if (styleFunction) {
|
||||||
}
|
styles = styleFunction(feature, resolution);
|
||||||
if (styles) {
|
}
|
||||||
const dirty = this.renderFeature(
|
if (styles) {
|
||||||
feature,
|
const dirty = this.renderFeature(
|
||||||
squaredTolerance,
|
feature,
|
||||||
styles,
|
squaredTolerance,
|
||||||
replayGroup,
|
styles,
|
||||||
userTransform
|
replayGroup,
|
||||||
);
|
userTransform
|
||||||
this.dirty_ = this.dirty_ || dirty;
|
);
|
||||||
}
|
this.dirty_ = this.dirty_ || dirty;
|
||||||
}.bind(this);
|
}
|
||||||
|
}.bind(this);
|
||||||
|
|
||||||
const userExtent = toUserExtent(extent, projection);
|
const userExtent = toUserExtent(extent, projection);
|
||||||
/** @type {Array<import("../../Feature.js").default>} */
|
/** @type {Array<import("../../Feature.js").default>} */
|
||||||
|
|||||||
@@ -267,6 +267,10 @@ class WebGLPointsLayerRenderer extends WebGLLayerRenderer {
|
|||||||
this.worker_ = createWebGLWorker();
|
this.worker_ = createWebGLWorker();
|
||||||
this.worker_.addEventListener(
|
this.worker_.addEventListener(
|
||||||
'message',
|
'message',
|
||||||
|
/**
|
||||||
|
* @param {*} event Event.
|
||||||
|
* @this {WebGLPointsLayerRenderer}
|
||||||
|
*/
|
||||||
function (event) {
|
function (event) {
|
||||||
const received = event.data;
|
const received = event.data;
|
||||||
if (received.type === WebGLWorkerMessageType.GENERATE_BUFFERS) {
|
if (received.type === WebGLWorkerMessageType.GENERATE_BUFFERS) {
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ import {linearFindNearest} from './array.js';
|
|||||||
* Returns a modified resolution taking into account the viewport size and maximum
|
* Returns a modified resolution taking into account the viewport size and maximum
|
||||||
* allowed extent.
|
* allowed extent.
|
||||||
* @param {number} resolution Resolution
|
* @param {number} resolution Resolution
|
||||||
* @param {import("./extent.js").Extent=} maxExtent Maximum allowed extent.
|
* @param {import("./extent.js").Extent} maxExtent Maximum allowed extent.
|
||||||
* @param {import("./size.js").Size} viewportSize Viewport size.
|
* @param {import("./size.js").Size} viewportSize Viewport size.
|
||||||
* @param {boolean} showFullExtent Whether to show the full extent.
|
* @param {boolean} showFullExtent Whether to show the full extent.
|
||||||
* @return {number} Capped resolution.
|
* @return {number} Capped resolution.
|
||||||
|
|||||||
Reference in New Issue
Block a user