@antv/l7-core
Advanced tools
Comparing version 2.10.9 to 2.10.11
@@ -16,3 +16,3 @@ import { EventEmitter } from 'eventemitter3'; | ||
init(): void; | ||
addImage(id: string, image: IImage): void; | ||
addImage(id: string, image: IImage): Promise<void>; | ||
/** | ||
@@ -19,0 +19,0 @@ * 适配小程序 |
@@ -0,1 +1,2 @@ | ||
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator"; | ||
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck"; | ||
@@ -11,2 +12,4 @@ import _createClass from "@babel/runtime/helpers/esm/createClass"; | ||
import _regeneratorRuntime from "@babel/runtime/regenerator"; | ||
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } | ||
@@ -74,33 +77,54 @@ | ||
key: "addImage", | ||
value: function addImage(id, image) { | ||
var _this2 = this; | ||
value: function () { | ||
var _addImage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(id, image) { | ||
var imagedata, iconImage; | ||
return _regeneratorRuntime.wrap(function _callee$(_context) { | ||
while (1) { | ||
switch (_context.prev = _context.next) { | ||
case 0: | ||
imagedata = new Image(); | ||
this.loadingImageCount++; | ||
var imagedata = new Image(); | ||
this.loadingImageCount++; | ||
if (this.hasImage(id)) { | ||
console.warn('Image Id already exists'); | ||
} | ||
if (this.hasImage(id)) { | ||
throw new Error('Image Id already exists'); | ||
} | ||
this.iconData.push({ | ||
id: id, | ||
size: imageSize | ||
}); | ||
this.updateIconMap(); | ||
_context.next = 7; | ||
return this.loadImage(image); | ||
this.iconData.push({ | ||
id: id, | ||
size: imageSize | ||
}); | ||
this.updateIconMap(); | ||
this.loadImage(image).then(function (img) { | ||
imagedata = img; | ||
case 7: | ||
imagedata = _context.sent; | ||
// imagedata = this.loadImage(image) | ||
// imagedata = img as HTMLImageElement; | ||
iconImage = this.iconData.find(function (icon) { | ||
return icon.id === id; | ||
}); | ||
var iconImage = _this2.iconData.find(function (icon) { | ||
return icon.id === id; | ||
}); | ||
if (iconImage) { | ||
iconImage.image = imagedata; | ||
iconImage.width = imagedata.width; | ||
iconImage.height = imagedata.height; | ||
} | ||
if (iconImage) { | ||
iconImage.image = imagedata; | ||
iconImage.width = imagedata.width; | ||
iconImage.height = imagedata.height; | ||
} | ||
this.update(); | ||
_this2.update(); | ||
}); | ||
} | ||
case 11: | ||
case "end": | ||
return _context.stop(); | ||
} | ||
} | ||
}, _callee, this); | ||
})); | ||
function addImage(_x, _x2) { | ||
return _addImage.apply(this, arguments); | ||
} | ||
return addImage; | ||
}() | ||
/** | ||
@@ -116,3 +140,3 @@ * 适配小程序 | ||
value: function addImageMini(id, image, sceneService) { | ||
var _this3 = this; | ||
var _this2 = this; | ||
@@ -136,3 +160,3 @@ var canvas = sceneService.getSceneConfig().canvas; // @ts-ignore | ||
var iconImage = _this3.iconData.find(function (icon) { | ||
var iconImage = _this2.iconData.find(function (icon) { | ||
return icon.id === id; | ||
@@ -147,3 +171,3 @@ }); | ||
_this3.update(); | ||
_this2.update(); | ||
}); | ||
@@ -231,3 +255,3 @@ } | ||
value: function updateIconAtlas() { | ||
var _this4 = this; | ||
var _this3 = this; | ||
@@ -237,10 +261,10 @@ this.canvas.width = MAX_CANVAS_WIDTH; | ||
Object.keys(this.iconMap).forEach(function (item) { | ||
var _this4$iconMap$item = _this4.iconMap[item], | ||
x = _this4$iconMap$item.x, | ||
y = _this4$iconMap$item.y, | ||
image = _this4$iconMap$item.image, | ||
_this4$iconMap$item$w = _this4$iconMap$item.width, | ||
width = _this4$iconMap$item$w === void 0 ? 64 : _this4$iconMap$item$w, | ||
_this4$iconMap$item$h = _this4$iconMap$item.height, | ||
height = _this4$iconMap$item$h === void 0 ? 64 : _this4$iconMap$item$h; | ||
var _this3$iconMap$item = _this3.iconMap[item], | ||
x = _this3$iconMap$item.x, | ||
y = _this3$iconMap$item.y, | ||
image = _this3$iconMap$item.image, | ||
_this3$iconMap$item$w = _this3$iconMap$item.width, | ||
width = _this3$iconMap$item$w === void 0 ? 64 : _this3$iconMap$item$w, | ||
_this3$iconMap$item$h = _this3$iconMap$item.height, | ||
height = _this3$iconMap$item$h === void 0 ? 64 : _this3$iconMap$item$h; | ||
var max = Math.max(width, height); | ||
@@ -252,3 +276,3 @@ var ratio = max / imageSize; | ||
if (image) { | ||
_this4.ctx.drawImage(image, x + (imageSize - drawWidth) / 2, y + (imageSize - drawHeight) / 2, drawWidth, drawHeight); | ||
_this3.ctx.drawImage(image, x + (imageSize - drawWidth) / 2, y + (imageSize - drawHeight) / 2, drawWidth, drawHeight); | ||
} | ||
@@ -255,0 +279,0 @@ }); |
import EventEmitter from 'eventemitter3'; | ||
import { ITexture2D } from '../renderer/ITexture2D'; | ||
import { ISceneService } from '../scene/ISceneService'; | ||
export type IImage = HTMLImageElement | File | string; | ||
export type Listener = (...args: any[]) => void; | ||
export declare type IImage = HTMLImageElement | File | string; | ||
export declare type Listener = (...args: any[]) => void; | ||
export interface IIconValue { | ||
@@ -7,0 +7,0 @@ x: number; |
@@ -16,3 +16,3 @@ import { Container } from 'inversify'; | ||
} | ||
export type PositionName = 'topright' | 'topleft' | 'bottomright' | 'bottomleft' | 'topcenter' | 'bottomcenter' | 'leftcenter' | 'rightcenter' | 'lefttop' | 'righttop' | 'leftbottom' | 'rightbottom'; | ||
export declare type PositionName = 'topright' | 'topleft' | 'bottomright' | 'bottomleft' | 'topcenter' | 'bottomcenter' | 'leftcenter' | 'rightcenter' | 'lefttop' | 'righttop' | 'leftbottom' | 'rightbottom'; | ||
export interface IControlServiceCfg { | ||
@@ -19,0 +19,0 @@ container: HTMLElement; |
@@ -5,3 +5,3 @@ import { anchorType } from '@antv/l7-utils'; | ||
import { ILngLat } from '../map/IMapService'; | ||
export type PopupHTML = string | HTMLElement | HTMLElement[]; | ||
export declare type PopupHTML = string | HTMLElement | HTMLElement[]; | ||
export interface IPopupOption { | ||
@@ -8,0 +8,0 @@ /** |
@@ -347,3 +347,3 @@ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray"; | ||
case 0: | ||
if (this.isPickingAllLayer()) { | ||
if (!(!this.layerService.needPick(target.type) || !this.isPickingAllLayer())) { | ||
_context2.next = 2; | ||
@@ -350,0 +350,0 @@ break; |
@@ -88,3 +88,3 @@ import { SyncBailHook, SyncHook, AsyncSeriesBailHook, AsyncWaterfallHook } from '@antv/async-hook'; | ||
} | ||
type ILngLat = [number, number]; | ||
declare type ILngLat = [number, number]; | ||
export interface ILegend { | ||
@@ -104,3 +104,3 @@ type: ScaleTypeName | undefined; | ||
} | ||
export type LegendItems = ILegendSegmentItem[] | ILegendClassificaItem[]; | ||
export declare type LegendItems = ILegendSegmentItem[] | ILegendClassificaItem[]; | ||
export interface IAttributeAndElements { | ||
@@ -223,3 +223,3 @@ attributes: any; | ||
} | ||
export type LayerEventType = 'inited' | 'legend' | 'legend:color' | 'legend:size' | 'add' | 'remove' | 'destroy' | 'contextmenu' | 'uncontextmenu' | 'unpick' | 'mousedown' | 'unmousedown' | 'unclick' | 'undblclick' | 'unmouseenter' | 'unmousemove' | 'mouseout' | 'click' | 'dblclick' | 'mouseenter' | 'unmousemove' | 'mouseout' | 'show' | 'hide' | any; | ||
export declare type LayerEventType = 'inited' | 'legend' | 'legend:color' | 'legend:size' | 'add' | 'remove' | 'destroy' | 'contextmenu' | 'uncontextmenu' | 'unpick' | 'mousedown' | 'unmousedown' | 'unclick' | 'undblclick' | 'unmouseenter' | 'unmousemove' | 'mouseout' | 'click' | 'dblclick' | 'mouseenter' | 'unmousemove' | 'mouseout' | 'show' | 'hide' | any; | ||
export interface ILayer { | ||
@@ -503,3 +503,3 @@ styleAttributeService: IStyleAttributeService; | ||
} | ||
export type LayerServiceEvent = 'layerChange'; | ||
export declare type LayerServiceEvent = 'layerChange'; | ||
/** | ||
@@ -538,2 +538,3 @@ * 提供 Layer 管理服务 | ||
renderLayer(layer: ILayer): Promise<void>; | ||
needPick(type: string): boolean; | ||
throttleRenderLayers(): void; | ||
@@ -540,0 +541,0 @@ renderLayers(): void; |
@@ -24,4 +24,4 @@ import { IAttribute, IAttributeInitializationOptions } from '../renderer/IAttribute'; | ||
} | ||
export type ScaleTypeName = 'linear' | 'power' | 'log' | 'identity' | 'time' | 'quantile' | 'quantize' | 'threshold' | 'diverging' | 'sequential' | 'cat'; | ||
export type ScaleAttributeType = 'color' | 'size' | 'shape'; | ||
export declare type ScaleTypeName = 'linear' | 'power' | 'log' | 'identity' | 'time' | 'quantile' | 'quantize' | 'threshold' | 'diverging' | 'sequential' | 'cat'; | ||
export declare type ScaleAttributeType = 'color' | 'size' | 'shape'; | ||
export interface IScale { | ||
@@ -90,8 +90,8 @@ type: ScaleTypeName; | ||
} | ||
export type Position = number[]; | ||
type Color = [number, number, number, number]; | ||
type CallBack = (...args: any[]) => any; | ||
export type StyleAttributeField = string | string[] | number[] | number; | ||
export type StyleAttributeOption = string | number | boolean | any[] | CallBack; | ||
export type StyleAttrField = string | string[] | number | number[]; | ||
export declare type Position = number[]; | ||
declare type Color = [number, number, number, number]; | ||
declare type CallBack = (...args: any[]) => any; | ||
export declare type StyleAttributeField = string | string[] | number[] | number; | ||
export declare type StyleAttributeOption = string | number | boolean | any[] | CallBack; | ||
export declare type StyleAttrField = string | string[] | number | number[]; | ||
export interface IAttributeScale { | ||
@@ -138,3 +138,3 @@ field: string | number; | ||
} | ||
export type Triangulation = (feature: IEncodeFeature, segmentNumber?: number) => { | ||
export declare type Triangulation = (feature: IEncodeFeature, segmentNumber?: number) => { | ||
vertices: number[]; | ||
@@ -141,0 +141,0 @@ indices: number[]; |
@@ -20,2 +20,3 @@ import { EventEmitter } from 'eventemitter3'; | ||
throttleRenderLayers: import("lodash").DebouncedFunc<() => void>; | ||
needPick(type: string): boolean; | ||
add(layer: ILayer): void; | ||
@@ -22,0 +23,0 @@ addMask(mask: ILayer): void; |
@@ -75,2 +75,4 @@ import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator"; | ||
_defineProperty(_assertThisInitialized(_this), "reRender", throttle(function () { | ||
_this.clear(); | ||
_this.updateLayerRenderList(); | ||
@@ -89,2 +91,9 @@ | ||
_createClass(LayerService, [{ | ||
key: "needPick", | ||
value: function needPick(type) { | ||
return this.layerList.some(function (layer) { | ||
return layer.needPick(type); | ||
}); | ||
} | ||
}, { | ||
key: "add", | ||
@@ -91,0 +100,0 @@ value: function add(layer) { |
import { Container } from 'inversify'; | ||
import { IViewport } from '../camera/ICameraService'; | ||
export type Point = [number, number]; | ||
export type Bounds = [[number, number], [number, number]]; | ||
export declare type Point = [number, number]; | ||
export declare type Bounds = [[number, number], [number, number]]; | ||
export interface ILngLat { | ||
@@ -27,7 +27,7 @@ lng: number; | ||
} | ||
export type MapStyleName = 'normal' | 'light' | 'dark' | string; | ||
export type MapStyleConfig = { | ||
export declare type MapStyleName = 'normal' | 'light' | 'dark' | string; | ||
export declare type MapStyleConfig = { | ||
[key: MapStyleName]: string | any; | ||
}; | ||
export type MapStyle = MapStyleName | any; | ||
export declare type MapStyle = MapStyleName | any; | ||
export interface IMapWrapper { | ||
@@ -34,0 +34,0 @@ setContainer(container: Container, id: string | HTMLDivElement, canvas?: HTMLCanvasElement, hasBaseMap?: boolean): void; |
@@ -14,4 +14,4 @@ import { gl } from './gl'; | ||
} | ||
type stencilOp = gl.ZERO | gl.KEEP | gl.REPLACE | gl.INVERT | gl.INCR | gl.DECR | gl.INCR_WRAP | gl.DECR_WRAP; | ||
type BlendingFunctionSeparate = Partial<{ | ||
declare type stencilOp = gl.ZERO | gl.KEEP | gl.REPLACE | gl.INVERT | gl.INCR | gl.DECR | gl.INCR_WRAP | gl.DECR_WRAP; | ||
declare type BlendingFunctionSeparate = Partial<{ | ||
srcRGB: gl.ZERO | gl.ONE | gl.SRC_COLOR | gl.ONE_MINUS_SRC_COLOR | gl.SRC_ALPHA | gl.ONE_MINUS_SRC_ALPHA | gl.DST_COLOR | gl.ONE_MINUS_DST_COLOR | gl.DST_ALPHA | gl.ONE_MINUS_DST_ALPHA | gl.CONSTANT_COLOR | gl.ONE_MINUS_CONSTANT_COLOR | gl.CONSTANT_ALPHA | gl.ONE_MINUS_CONSTANT_ALPHA | gl.SRC_ALPHA_SATURATE; | ||
@@ -18,0 +18,0 @@ srcAlpha: number; |
@@ -6,3 +6,3 @@ import { IFramebuffer } from './IFramebuffer'; | ||
} | ||
export type IUniform = number | number[] | ArrayBufferView | boolean | IFramebuffer | ITexture2D | IStruct | null; | ||
export declare type IUniform = number | number[] | ArrayBufferView | boolean | IFramebuffer | ITexture2D | IStruct | null; | ||
export {}; |
import { TilesetManager } from '@antv/l7-utils'; | ||
import { BBox } from '@turf/helpers'; | ||
export type DataType = string | object[] | object; | ||
export type SourceEventType = 'inited' | 'sourceUpdate' | 'update'; | ||
export declare type DataType = string | object[] | object; | ||
export declare type SourceEventType = 'inited' | 'sourceUpdate' | 'update'; | ||
import { RequestParameters } from "@antv/l7-utils"; | ||
@@ -59,3 +59,3 @@ export declare enum RasterTileType { | ||
} | ||
type CallBack = (...args: any[]) => any; | ||
declare type CallBack = (...args: any[]) => any; | ||
export interface ITransform { | ||
@@ -105,3 +105,3 @@ type: string; | ||
} | ||
export type IJsonData = IJsonItem[]; | ||
export declare type IJsonData = IJsonItem[]; | ||
export interface ISource { | ||
@@ -108,0 +108,0 @@ inited: boolean; |
@@ -10,2 +10,6 @@ "use strict"; | ||
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator")); | ||
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator")); | ||
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck")); | ||
@@ -86,33 +90,54 @@ | ||
key: "addImage", | ||
value: function addImage(id, image) { | ||
var _this2 = this; | ||
value: function () { | ||
var _addImage = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(id, image) { | ||
var imagedata, iconImage; | ||
return _regenerator.default.wrap(function _callee$(_context) { | ||
while (1) { | ||
switch (_context.prev = _context.next) { | ||
case 0: | ||
imagedata = new Image(); | ||
this.loadingImageCount++; | ||
var imagedata = new Image(); | ||
this.loadingImageCount++; | ||
if (this.hasImage(id)) { | ||
console.warn('Image Id already exists'); | ||
} | ||
if (this.hasImage(id)) { | ||
throw new Error('Image Id already exists'); | ||
} | ||
this.iconData.push({ | ||
id: id, | ||
size: imageSize | ||
}); | ||
this.updateIconMap(); | ||
_context.next = 7; | ||
return this.loadImage(image); | ||
this.iconData.push({ | ||
id: id, | ||
size: imageSize | ||
}); | ||
this.updateIconMap(); | ||
this.loadImage(image).then(function (img) { | ||
imagedata = img; | ||
case 7: | ||
imagedata = _context.sent; | ||
// imagedata = this.loadImage(image) | ||
// imagedata = img as HTMLImageElement; | ||
iconImage = this.iconData.find(function (icon) { | ||
return icon.id === id; | ||
}); | ||
var iconImage = _this2.iconData.find(function (icon) { | ||
return icon.id === id; | ||
}); | ||
if (iconImage) { | ||
iconImage.image = imagedata; | ||
iconImage.width = imagedata.width; | ||
iconImage.height = imagedata.height; | ||
} | ||
if (iconImage) { | ||
iconImage.image = imagedata; | ||
iconImage.width = imagedata.width; | ||
iconImage.height = imagedata.height; | ||
} | ||
this.update(); | ||
_this2.update(); | ||
}); | ||
} | ||
case 11: | ||
case "end": | ||
return _context.stop(); | ||
} | ||
} | ||
}, _callee, this); | ||
})); | ||
function addImage(_x, _x2) { | ||
return _addImage.apply(this, arguments); | ||
} | ||
return addImage; | ||
}() | ||
/** | ||
@@ -128,3 +153,3 @@ * 适配小程序 | ||
value: function addImageMini(id, image, sceneService) { | ||
var _this3 = this; | ||
var _this2 = this; | ||
@@ -148,3 +173,3 @@ var canvas = sceneService.getSceneConfig().canvas; // @ts-ignore | ||
var iconImage = _this3.iconData.find(function (icon) { | ||
var iconImage = _this2.iconData.find(function (icon) { | ||
return icon.id === id; | ||
@@ -159,3 +184,3 @@ }); | ||
_this3.update(); | ||
_this2.update(); | ||
}); | ||
@@ -243,3 +268,3 @@ } | ||
value: function updateIconAtlas() { | ||
var _this4 = this; | ||
var _this3 = this; | ||
@@ -249,10 +274,10 @@ this.canvas.width = MAX_CANVAS_WIDTH; | ||
Object.keys(this.iconMap).forEach(function (item) { | ||
var _this4$iconMap$item = _this4.iconMap[item], | ||
x = _this4$iconMap$item.x, | ||
y = _this4$iconMap$item.y, | ||
image = _this4$iconMap$item.image, | ||
_this4$iconMap$item$w = _this4$iconMap$item.width, | ||
width = _this4$iconMap$item$w === void 0 ? 64 : _this4$iconMap$item$w, | ||
_this4$iconMap$item$h = _this4$iconMap$item.height, | ||
height = _this4$iconMap$item$h === void 0 ? 64 : _this4$iconMap$item$h; | ||
var _this3$iconMap$item = _this3.iconMap[item], | ||
x = _this3$iconMap$item.x, | ||
y = _this3$iconMap$item.y, | ||
image = _this3$iconMap$item.image, | ||
_this3$iconMap$item$w = _this3$iconMap$item.width, | ||
width = _this3$iconMap$item$w === void 0 ? 64 : _this3$iconMap$item$w, | ||
_this3$iconMap$item$h = _this3$iconMap$item.height, | ||
height = _this3$iconMap$item$h === void 0 ? 64 : _this3$iconMap$item$h; | ||
var max = Math.max(width, height); | ||
@@ -264,3 +289,3 @@ var ratio = max / imageSize; | ||
if (image) { | ||
_this4.ctx.drawImage(image, x + (imageSize - drawWidth) / 2, y + (imageSize - drawHeight) / 2, drawWidth, drawHeight); | ||
_this3.ctx.drawImage(image, x + (imageSize - drawWidth) / 2, y + (imageSize - drawHeight) / 2, drawWidth, drawHeight); | ||
} | ||
@@ -267,0 +292,0 @@ }); |
@@ -359,3 +359,3 @@ "use strict"; | ||
case 0: | ||
if (this.isPickingAllLayer()) { | ||
if (!(!this.layerService.needPick(target.type) || !this.isPickingAllLayer())) { | ||
_context2.next = 2; | ||
@@ -362,0 +362,0 @@ break; |
@@ -88,2 +88,4 @@ "use strict"; | ||
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "reRender", (0, _lodash.throttle)(function () { | ||
_this.clear(); | ||
_this.updateLayerRenderList(); | ||
@@ -100,2 +102,9 @@ | ||
(0, _createClass2.default)(LayerService, [{ | ||
key: "needPick", | ||
value: function needPick(type) { | ||
return this.layerList.some(function (layer) { | ||
return layer.needPick(type); | ||
}); | ||
} | ||
}, { | ||
key: "add", | ||
@@ -102,0 +111,0 @@ value: function add(layer) { |
{ | ||
"name": "@antv/l7-core", | ||
"version": "2.10.9", | ||
"version": "2.10.11", | ||
"description": "", | ||
@@ -28,3 +28,3 @@ "main": "lib/index.js", | ||
"@antv/async-hook": "^2.2.9", | ||
"@antv/l7-utils": "2.10.9", | ||
"@antv/l7-utils": "2.10.11", | ||
"@babel/runtime": "^7.7.7", | ||
@@ -52,3 +52,3 @@ "@turf/helpers": "^6.1.4", | ||
}, | ||
"gitHead": "9fe64ef00875f4d96771542c16842468e61a8ef4", | ||
"gitHead": "a49e148b5fcb89f302e6bd53c1a628c07e006f43", | ||
"publishConfig": { | ||
@@ -55,0 +55,0 @@ "access": "public" |
968101
19492
+ Added@antv/l7-utils@2.10.11(transitive)
- Removed@antv/l7-utils@2.10.9(transitive)
Updated@antv/l7-utils@2.10.11