Use FeatureLike typedef

Use `import("./Feature.js").FeatureLike` typedef instead of `import("./Feature.js").default|import("./render/Feature.js").default`
This commit is contained in:
Frederic Junod
2018-10-02 12:58:55 +02:00
parent 023ad3c531
commit ae87cad7ef
15 changed files with 38 additions and 41 deletions

View File

@@ -59,7 +59,7 @@ class LayerRenderer extends Observable {
* @param {import("../coordinate.js").Coordinate} coordinate Coordinate.
* @param {import("../PluggableMap.js").FrameState} frameState Frame state.
* @param {number} hitTolerance Hit tolerance in pixels.
* @param {function((import("../Feature.js").default|import("../render/Feature.js").default), import("../layer/Layer.js").default): T} callback Feature callback.
* @param {function(import("../Feature.js").FeatureLike, import("../layer/Layer.js").default): T} callback Feature callback.
* @return {T|void} Callback result.
* @template T
*/

View File

@@ -93,7 +93,7 @@ class MapRenderer extends Disposable {
* @param {import("../coordinate.js").Coordinate} coordinate Coordinate.
* @param {import("../PluggableMap.js").FrameState} frameState FrameState.
* @param {number} hitTolerance Hit tolerance in pixels.
* @param {function(this: S, (import("../Feature.js").default|import("../render/Feature.js").default),
* @param {function(this: S, import("../Feature.js").FeatureLike,
* import("../layer/Layer.js").default): T} callback Feature callback.
* @param {S} thisArg Value to use as `this` when executing `callback`.
* @param {function(this: U, import("../layer/Layer.js").default): boolean} layerFilter Layer filter
@@ -118,7 +118,7 @@ class MapRenderer extends Disposable {
const viewResolution = viewState.resolution;
/**
* @param {import("../Feature.js").default|import("../render/Feature.js").default} feature Feature.
* @param {import("../Feature.js").FeatureLike} feature Feature.
* @param {import("../layer/Layer.js").default} layer Layer.
* @return {?} Callback result.
*/

View File

@@ -99,7 +99,7 @@ class IntermediateCanvasRenderer extends CanvasLayerRenderer {
return source.forEachFeatureAtCoordinate(
coordinate, resolution, rotation, hitTolerance, skippedFeatureUids,
/**
* @param {import("../../Feature.js").default|import("../../render/Feature.js").default} feature Feature.
* @param {import("../../Feature.js").FeatureLike} feature Feature.
* @return {?} Callback result.
*/
function(feature) {

View File

@@ -240,7 +240,7 @@ class CanvasVectorLayerRenderer extends CanvasLayerRenderer {
const features = {};
const result = this.replayGroup_.forEachFeatureAtCoordinate(coordinate, resolution, rotation, hitTolerance, {},
/**
* @param {import("../../Feature.js").default|import("../../render/Feature.js").default} feature Feature.
* @param {import("../../Feature.js").FeatureLike} feature Feature.
* @return {?} Callback result.
*/
function(feature) {

View File

@@ -182,7 +182,7 @@ class CanvasVectorTileLayerRenderer extends CanvasTileLayerRenderer {
const squaredTolerance = getSquaredRenderTolerance(resolution, pixelRatio);
/**
* @param {import("../../Feature.js").default|import("../../render/Feature.js").default} feature Feature.
* @param {import("../../Feature.js").FeatureLike} feature Feature.
* @this {CanvasVectorTileLayerRenderer}
*/
const render = function(feature) {
@@ -257,7 +257,7 @@ class CanvasVectorTileLayerRenderer extends CanvasTileLayerRenderer {
replayGroup = sourceTile.getReplayGroup(layer, tile.tileCoord.toString());
found = found || replayGroup.forEachFeatureAtCoordinate(coordinate, resolution, rotation, hitTolerance, {},
/**
* @param {import("../../Feature.js").default|import("../../render/Feature.js").default} feature Feature.
* @param {import("../../Feature.js").FeatureLike} feature Feature.
* @return {?} Callback result.
*/
function(feature) {
@@ -411,7 +411,7 @@ class CanvasVectorTileLayerRenderer extends CanvasTileLayerRenderer {
}
/**
* @param {import("../../Feature.js").default|import("../../render/Feature.js").default} feature Feature.
* @param {import("../../Feature.js").FeatureLike} feature Feature.
* @param {number} squaredTolerance Squared tolerance.
* @param {import("../../style/Style.js").default|Array<import("../../style/Style.js").default>} styles The style or array of styles.
* @param {import("../../render/canvas/ReplayGroup.js").default} replayGroup Replay group.

View File

@@ -33,8 +33,8 @@ const GEOMETRY_RENDERERS = {
/**
* @param {import("../Feature.js").default|import("../render/Feature.js").default} feature1 Feature 1.
* @param {import("../Feature.js").default|import("../render/Feature.js").default} feature2 Feature 2.
* @param {import("../Feature.js").FeatureLike} feature1 Feature 1.
* @param {import("../Feature.js").FeatureLike} feature2 Feature 2.
* @return {number} Order.
*/
export function defaultOrder(feature1, feature2) {
@@ -88,7 +88,7 @@ function renderCircleGeometry(replayGroup, geometry, style, feature) {
/**
* @param {import("../render/ReplayGroup.js").default} replayGroup Replay group.
* @param {import("../Feature.js").default|import("../render/Feature.js").default} feature Feature.
* @param {import("../Feature.js").FeatureLike} feature Feature.
* @param {import("../style/Style.js").default} style Style.
* @param {number} squaredTolerance Squared tolerance.
* @param {function(this: T, import("../events/Event.js").default)} listener Listener function.
@@ -120,7 +120,7 @@ export function renderFeature(replayGroup, feature, style, squaredTolerance, lis
/**
* @param {import("../render/ReplayGroup.js").default} replayGroup Replay group.
* @param {import("../Feature.js").default|import("../render/Feature.js").default} feature Feature.
* @param {import("../Feature.js").FeatureLike} feature Feature.
* @param {import("../style/Style.js").default} style Style.
* @param {number} squaredTolerance Squared tolerance.
*/
@@ -144,7 +144,7 @@ function renderFeatureInternal(replayGroup, feature, style, squaredTolerance) {
* @param {import("../render/ReplayGroup.js").default} replayGroup Replay group.
* @param {import("../geom/Geometry.js").default} geometry Geometry.
* @param {import("../style/Style.js").default} style Style.
* @param {import("../Feature.js").default|import("../render/Feature.js").default} feature Feature.
* @param {import("../Feature.js").FeatureLike} feature Feature.
*/
function renderGeometry(replayGroup, geometry, style, feature) {
if (geometry.getType() == GeometryType.GEOMETRY_COLLECTION) {
@@ -180,7 +180,7 @@ function renderGeometryCollectionGeometry(replayGroup, geometry, style, feature)
* @param {import("../render/ReplayGroup.js").default} replayGroup Replay group.
* @param {import("../geom/LineString.js").default|import("../render/Feature.js").default} geometry Geometry.
* @param {import("../style/Style.js").default} style Style.
* @param {import("../Feature.js").default|import("../render/Feature.js").default} feature Feature.
* @param {import("../Feature.js").FeatureLike} feature Feature.
*/
function renderLineStringGeometry(replayGroup, geometry, style, feature) {
const strokeStyle = style.getStroke();
@@ -202,7 +202,7 @@ function renderLineStringGeometry(replayGroup, geometry, style, feature) {
* @param {import("../render/ReplayGroup.js").default} replayGroup Replay group.
* @param {import("../geom/MultiLineString.js").default|import("../render/Feature.js").default} geometry Geometry.
* @param {import("../style/Style.js").default} style Style.
* @param {import("../Feature.js").default|import("../render/Feature.js").default} feature Feature.
* @param {import("../Feature.js").FeatureLike} feature Feature.
*/
function renderMultiLineStringGeometry(replayGroup, geometry, style, feature) {
const strokeStyle = style.getStroke();
@@ -247,7 +247,7 @@ function renderMultiPolygonGeometry(replayGroup, geometry, style, feature) {
* @param {import("../render/ReplayGroup.js").default} replayGroup Replay group.
* @param {import("../geom/Point.js").default|import("../render/Feature.js").default} geometry Geometry.
* @param {import("../style/Style.js").default} style Style.
* @param {import("../Feature.js").default|import("../render/Feature.js").default} feature Feature.
* @param {import("../Feature.js").FeatureLike} feature Feature.
*/
function renderPointGeometry(replayGroup, geometry, style, feature) {
const imageStyle = style.getImage();
@@ -272,7 +272,7 @@ function renderPointGeometry(replayGroup, geometry, style, feature) {
* @param {import("../render/ReplayGroup.js").default} replayGroup Replay group.
* @param {import("../geom/MultiPoint.js").default|import("../render/Feature.js").default} geometry Geometry.
* @param {import("../style/Style.js").default} style Style.
* @param {import("../Feature.js").default|import("../render/Feature.js").default} feature Feature.
* @param {import("../Feature.js").FeatureLike} feature Feature.
*/
function renderMultiPointGeometry(replayGroup, geometry, style, feature) {
const imageStyle = style.getImage();
@@ -297,7 +297,7 @@ function renderMultiPointGeometry(replayGroup, geometry, style, feature) {
* @param {import("../render/ReplayGroup.js").default} replayGroup Replay group.
* @param {import("../geom/Polygon.js").default|import("../render/Feature.js").default} geometry Geometry.
* @param {import("../style/Style.js").default} style Style.
* @param {import("../Feature.js").default|import("../render/Feature.js").default} feature Feature.
* @param {import("../Feature.js").FeatureLike} feature Feature.
*/
function renderPolygonGeometry(replayGroup, geometry, style, feature) {
const fillStyle = style.getFill();

View File

@@ -88,7 +88,7 @@ class WebGLImageLayerRenderer extends WebGLLayerRenderer {
coordinate, resolution, rotation, hitTolerance, skippedFeatureUids,
/**
* @param {import("../../Feature.js").default|import("../../render/Feature.js").default} feature Feature.
* @param {import("../../Feature.js").FeatureLike} feature Feature.
* @return {?} Callback result.
*/
function(feature) {

View File

@@ -124,7 +124,7 @@ class WebGLVectorLayerRenderer extends WebGLLayerRenderer {
frameState.size, frameState.pixelRatio, layerState.opacity,
{},
/**
* @param {import("../../Feature.js").default|import("../../render/Feature.js").default} feature Feature.
* @param {import("../../Feature.js").FeatureLike} feature Feature.
* @return {?} Callback result.
*/
function(feature) {