@antv/l7-core
Advanced tools
Comparing version 2.9.23 to 2.9.24
@@ -11,6 +11,6 @@ /** | ||
} | ||
export declare const lazyInject: (serviceIdentifier: interfaces.ServiceIdentifier<any>) => (this: any, proto: any, key: string, descriptor?: IBabelPropertyDescriptor | undefined) => void; | ||
export declare const lazyMultiInject: (serviceIdentifier: interfaces.ServiceIdentifier<any>) => (this: any, proto: any, key: string, descriptor?: IBabelPropertyDescriptor | undefined) => void; | ||
export declare const lazyInject: (serviceIdentifier: interfaces.ServiceIdentifier<any>) => (this: any, proto: any, key: string, descriptor?: IBabelPropertyDescriptor) => void; | ||
export declare const lazyMultiInject: (serviceIdentifier: interfaces.ServiceIdentifier<any>) => (this: any, proto: any, key: string, descriptor?: IBabelPropertyDescriptor) => void; | ||
export default container; | ||
export declare function createSceneContainer(): Container; | ||
export declare function createLayerContainer(sceneContainer: Container): Container; |
@@ -513,11 +513,9 @@ import _classCallCheck from "@babel/runtime/helpers/classCallCheck"; | ||
value: function computeMatrix() { | ||
var rotX; | ||
var rotY; // 使用四元数描述 3D 旋转 | ||
// 使用四元数描述 3D 旋转 | ||
// @see https://xiaoiver.github.io/coding/2018/12/28/Camera-%E8%AE%BE%E8%AE%A1-%E4%B8%80.html | ||
var rotZ = quat.setAxisAngle(quat.create(), [0, 0, 1], this.roll * DEG_2_RAD); | ||
mat4.identity(this.matrix); // only consider HCS for EXPLORING and ORBITING cameras | ||
rotX = quat.setAxisAngle(quat.create(), [1, 0, 0], (this.rotateWorld || this.type === CAMERA_TYPE.TRACKING ? 1 : -1) * this.elevation * DEG_2_RAD); | ||
rotY = quat.setAxisAngle(quat.create(), [0, 1, 0], (this.rotateWorld ? 1 : -1) * this.azimuth * DEG_2_RAD); | ||
var rotX = quat.setAxisAngle(quat.create(), [1, 0, 0], (this.rotateWorld || this.type === CAMERA_TYPE.TRACKING ? 1 : -1) * this.elevation * DEG_2_RAD); | ||
var rotY = quat.setAxisAngle(quat.create(), [0, 1, 0], (this.rotateWorld ? 1 : -1) * this.azimuth * DEG_2_RAD); | ||
var rotQ = quat.multiply(quat.create(), rotY, rotX); | ||
@@ -524,0 +522,0 @@ rotQ = quat.multiply(quat.create(), rotQ, rotZ); |
@@ -8,2 +8,3 @@ import { PositionName } from '../component/IControlService'; | ||
canvas?: HTMLCanvasElement; | ||
gl?: any; | ||
hasBaseMap?: boolean; | ||
@@ -10,0 +11,0 @@ map: IMapWrapper; |
@@ -0,1 +1,4 @@ | ||
/** | ||
* 地图 Schema | ||
*/ | ||
declare const _default: { | ||
@@ -31,5 +34,2 @@ properties: { | ||
}; | ||
/** | ||
* 地图 Schema | ||
*/ | ||
export default _default; |
@@ -0,7 +1,7 @@ | ||
/** | ||
* 场景 Schema | ||
*/ | ||
declare const _default: { | ||
properties: {}; | ||
}; | ||
/** | ||
* 场景 Schema | ||
*/ | ||
export default _default; |
@@ -50,4 +50,2 @@ import _slicedToArray from "@babel/runtime/helpers/slicedToArray"; | ||
_defineProperty(this, "pickFromPickingFBO", function (layer, _ref) { | ||
var _pickedColors; | ||
var x = _ref.x, | ||
@@ -60,3 +58,2 @@ y = _ref.y, | ||
var _this$rendererService = _this.rendererService, | ||
getViewportSize = _this$rendererService.getViewportSize, | ||
readPixels = _this$rendererService.readPixels, | ||
@@ -83,4 +80,3 @@ getContainer = _this$rendererService.getContainer; | ||
var pickedColors; | ||
pickedColors = readPixels({ | ||
var pickedColors = readPixels({ | ||
x: Math.floor(xInDevicePixel / _this.pickBufferScale), | ||
@@ -157,3 +153,3 @@ // 视口坐标系原点在左上,而 WebGL 在左下,需要翻转 Y 轴 | ||
if (enableSelect && type === 'click' && ((_pickedColors = pickedColors) === null || _pickedColors === void 0 ? void 0 : _pickedColors.toString()) !== [0, 0, 0, 0].toString()) { | ||
if (enableSelect && type === 'click' && (pickedColors === null || pickedColors === void 0 ? void 0 : pickedColors.toString()) !== [0, 0, 0, 0].toString()) { | ||
var selectedId = decodePickingColor(pickedColors); | ||
@@ -192,3 +188,2 @@ | ||
createFramebuffer = _this$rendererService2.createFramebuffer, | ||
getViewportSize = _this$rendererService2.getViewportSize, | ||
getContainer = _this$rendererService2.getContainer; | ||
@@ -275,3 +270,2 @@ | ||
var _this$rendererService4 = this.rendererService, | ||
getViewportSize = _this$rendererService4.getViewportSize, | ||
readPixels = _this$rendererService4.readPixels, | ||
@@ -291,6 +285,5 @@ getContainer = _this$rendererService4.getContainer; | ||
var pickedColors; | ||
var w = Math.min(width / this.pickBufferScale, xMax) - xMin; | ||
var h = Math.min(height / this.pickBufferScale, yMax) - yMin; | ||
pickedColors = readPixels({ | ||
var pickedColors = readPixels({ | ||
x: xMin, | ||
@@ -359,3 +352,3 @@ // 视口坐标系原点在左上,而 WebGL 在左下,需要翻转 Y 轴 | ||
function getContainerSize(container) { | ||
if (!!container.getContext) { | ||
if (container.getContext) { | ||
return { | ||
@@ -542,6 +535,6 @@ width: container.width / DOM.DPR, | ||
// @ts-ignore | ||
var _pickedColors2 = _slicedToArray(pickedColors, 3), | ||
r = _pickedColors2[0], | ||
g = _pickedColors2[1], | ||
b = _pickedColors2[2]; | ||
var _pickedColors = _slicedToArray(pickedColors, 3), | ||
r = _pickedColors[0], | ||
g = _pickedColors[1], | ||
b = _pickedColors[2]; | ||
@@ -554,6 +547,6 @@ layer.hooks.beforeHighlight.call([r, g, b]); | ||
// @ts-ignore | ||
var _pickedColors3 = _slicedToArray(pickedColors, 3), | ||
r = _pickedColors3[0], | ||
g = _pickedColors3[1], | ||
b = _pickedColors3[2]; | ||
var _pickedColors2 = _slicedToArray(pickedColors, 3), | ||
r = _pickedColors2[0], | ||
g = _pickedColors2[1], | ||
b = _pickedColors2[2]; | ||
@@ -560,0 +553,0 @@ layer.hooks.beforeSelect.call([r, g, b]); |
@@ -14,3 +14,3 @@ import { SyncBailHook, SyncHook, SyncWaterfallHook } from '@antv/async-hook'; | ||
import { IUniform } from '../renderer/IUniform'; | ||
import { ISource, ISourceCFG } from '../source/ISourceService'; | ||
import { ISource, ISourceCFG, ITransform } from '../source/ISourceService'; | ||
import { IAnimateOption, IEncodeFeature, IScale, IScaleOptions, IScaleValue, IStyleAttribute, IStyleAttributeService, IStyleAttributeUpdateOptions, StyleAttrField, StyleAttributeField, StyleAttributeOption, Triangulation } from './IStyleAttributeService'; | ||
@@ -100,2 +100,3 @@ export declare enum BlendType { | ||
layerType: string; | ||
transforms: ITransform[]; | ||
shape?: string | string[] | IScaleValue; | ||
@@ -173,2 +174,3 @@ zIndex: number; | ||
pickingService: IPickingService; | ||
transforms: ITransform[]; | ||
} | ||
@@ -175,0 +177,0 @@ export declare type LayerEventType = 'inited' | 'add' | 'remove' | 'destroy' | 'contextmenu' | 'uncontextmenu' | 'unpick' | 'mousedown' | 'unmousedown' | 'unclick' | 'undblclick' | 'unmouseenter' | 'unmousemove' | 'mouseout' | 'click' | 'dblclick' | 'mouseenter' | 'unmousemove' | 'mouseout' | any; |
@@ -141,2 +141,3 @@ import { IAttribute, IAttributeInitializationOptions } from '../renderer/IAttribute'; | ||
indexes?: number[]; | ||
count?: number; | ||
}; | ||
@@ -163,2 +164,3 @@ export interface IStyleAttributeUpdateOptions { | ||
elements: IElements; | ||
count: number | null; | ||
}; | ||
@@ -165,0 +167,0 @@ createAttributesAndIndicesAscy(encodedFeatures: IEncodeFeature[], segmentNumber?: number, workerOptions?: any): Promise<any>; |
@@ -15,2 +15,3 @@ import 'reflect-metadata'; | ||
elements: IElements; | ||
count: number | null; | ||
}; | ||
@@ -33,2 +34,3 @@ private readonly rendererService; | ||
elements: IElements; | ||
count: number | null; | ||
}; | ||
@@ -35,0 +37,0 @@ createAttributes(features: IEncodeFeature[], triangulation: Triangulation): { |
@@ -228,3 +228,4 @@ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties"; | ||
attributes: attributes, | ||
elements: elements | ||
elements: elements, | ||
count: null | ||
}; | ||
@@ -258,2 +259,4 @@ resolve(_this.attributesAndIndices); | ||
var verticesNum = 0; | ||
var vecticesCount = 0; // 在不使用 element 的时候记录顶点、图层所有顶点的总数 | ||
var vertices = []; | ||
@@ -270,4 +273,9 @@ var indices = []; | ||
vertexSize = _this2$triangulation.size, | ||
indexes = _this2$triangulation.indexes; | ||
indexes = _this2$triangulation.indexes, | ||
count = _this2$triangulation.count; | ||
if (typeof count === 'number') { | ||
vecticesCount += count; | ||
} | ||
indicesForCurrentFeature.forEach(function (i) { | ||
@@ -346,3 +354,4 @@ indices.push(i + verticesNum); | ||
attributes: attributes, | ||
elements: elements | ||
elements: elements, | ||
count: vecticesCount | ||
}; | ||
@@ -349,0 +358,0 @@ return this.attributesAndIndices; |
@@ -37,3 +37,3 @@ import { IAttribute, IAttributeInitializationOptions } from './IAttribute'; | ||
extensionObject: IExtensions; | ||
init(canvas: HTMLCanvasElement, cfg: IRenderConfig): Promise<void>; | ||
init(canvas: HTMLCanvasElement, cfg: IRenderConfig, gl: any): Promise<void>; | ||
testExtension(name: string): boolean; | ||
@@ -40,0 +40,0 @@ clear(options: IClearOptions): void; |
@@ -233,3 +233,3 @@ import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator"; | ||
if (!$container) { | ||
_context2.next = 11; | ||
_context2.next = 12; | ||
break; | ||
@@ -244,5 +244,7 @@ } | ||
return _this2.rendererService.init( // @ts-ignore | ||
_this2.canvas, _this2.configService.getSceneConfig(_this2.id)); | ||
_this2.canvas, _this2.configService.getSceneConfig(_this2.id), sceneConfig.gl); | ||
case 7: | ||
_this2.initContainer(); | ||
elementResizeEvent(_this2.$container, _this2.handleWindowResized); | ||
@@ -254,12 +256,12 @@ | ||
_context2.next = 12; | ||
_context2.next = 13; | ||
break; | ||
case 11: | ||
case 12: | ||
console.error('容器 id 不存在'); | ||
case 12: | ||
case 13: | ||
_this2.pickingService.init(_this2.id); | ||
case 13: | ||
case 14: | ||
case "end": | ||
@@ -362,3 +364,3 @@ return _context2.stop(); | ||
return _this3.rendererService.init( // @ts-ignore | ||
sceneConfig.canvas, _this3.configService.getSceneConfig(_this3.id)); | ||
sceneConfig.canvas, _this3.configService.getSceneConfig(_this3.id), undefined); | ||
@@ -365,0 +367,0 @@ case 5: |
@@ -56,3 +56,3 @@ import _objectSpread from "@babel/runtime/helpers/objectSpread2"; | ||
var globalDefaultprecision = '#ifdef GL_FRAGMENT_PRECISION_HIGH\n precision highp float;\n #else\n precision mediump float;\n#endif\n'; | ||
var includeRegExp = /#pragma include (["^+"]?["\ "[a-zA-Z_0-9](.*)"]*?)/g; | ||
var includeRegExp = /#pragma include (["^+"]?["[a-zA-Z_0-9](.*)"]*?)/g; | ||
var ShaderModuleService = (_dec = injectable(), _dec(_class = /*#__PURE__*/function () { | ||
@@ -59,0 +59,0 @@ function ShaderModuleService() { |
@@ -266,8 +266,6 @@ var __defProp = Object.defineProperty; | ||
computeMatrix() { | ||
let rotX; | ||
let rotY; | ||
const rotZ = import_gl_matrix.quat.setAxisAngle(import_gl_matrix.quat.create(), [0, 0, 1], this.roll * DEG_2_RAD); | ||
import_gl_matrix.mat4.identity(this.matrix); | ||
rotX = import_gl_matrix.quat.setAxisAngle(import_gl_matrix.quat.create(), [1, 0, 0], (this.rotateWorld || this.type === "TRACKING" /* TRACKING */ ? 1 : -1) * this.elevation * DEG_2_RAD); | ||
rotY = import_gl_matrix.quat.setAxisAngle(import_gl_matrix.quat.create(), [0, 1, 0], (this.rotateWorld ? 1 : -1) * this.azimuth * DEG_2_RAD); | ||
const rotX = import_gl_matrix.quat.setAxisAngle(import_gl_matrix.quat.create(), [1, 0, 0], (this.rotateWorld || this.type === "TRACKING" /* TRACKING */ ? 1 : -1) * this.elevation * DEG_2_RAD); | ||
const rotY = import_gl_matrix.quat.setAxisAngle(import_gl_matrix.quat.create(), [0, 1, 0], (this.rotateWorld ? 1 : -1) * this.azimuth * DEG_2_RAD); | ||
let rotQ = import_gl_matrix.quat.multiply(import_gl_matrix.quat.create(), rotY, rotX); | ||
@@ -274,0 +272,0 @@ rotQ = import_gl_matrix.quat.multiply(import_gl_matrix.quat.create(), rotQ, rotZ); |
@@ -51,3 +51,3 @@ var __defProp = Object.defineProperty; | ||
let isPicked = false; | ||
const { getViewportSize, readPixels, getContainer } = this.rendererService; | ||
const { readPixels, getContainer } = this.rendererService; | ||
let { width, height } = this.getContainerSize(getContainer()); | ||
@@ -62,4 +62,3 @@ width *= import_l7_utils.DOM.DPR; | ||
} | ||
let pickedColors; | ||
pickedColors = readPixels({ | ||
const pickedColors = readPixels({ | ||
x: Math.floor(xInDevicePixel / this.pickBufferScale), | ||
@@ -138,3 +137,2 @@ y: Math.floor((height - (y + 1) * import_l7_utils.DOM.DPR) / this.pickBufferScale), | ||
createFramebuffer, | ||
getViewportSize, | ||
getContainer | ||
@@ -178,3 +176,3 @@ } = this.rendererService; | ||
}); | ||
const { getViewportSize, readPixels, getContainer } = this.rendererService; | ||
const { readPixels, getContainer } = this.rendererService; | ||
let { width, height } = this.getContainerSize(getContainer()); | ||
@@ -186,6 +184,5 @@ width *= import_l7_utils.DOM.DPR; | ||
} | ||
let pickedColors; | ||
const w = Math.min(width / this.pickBufferScale, xMax) - xMin; | ||
const h = Math.min(height / this.pickBufferScale, yMax) - yMin; | ||
pickedColors = readPixels({ | ||
const pickedColors = readPixels({ | ||
x: xMin, | ||
@@ -232,3 +229,3 @@ y: Math.floor(height / this.pickBufferScale - (yMax + 1)), | ||
getContainerSize(container) { | ||
if (!!container.getContext) { | ||
if (container.getContext) { | ||
return { | ||
@@ -235,0 +232,0 @@ width: container.width / import_l7_utils.DOM.DPR, |
@@ -175,3 +175,4 @@ var __create = Object.create; | ||
attributes, | ||
elements | ||
elements, | ||
count: null | ||
}; | ||
@@ -198,2 +199,3 @@ resolve(this.attributesAndIndices); | ||
let verticesNum = 0; | ||
let vecticesCount = 0; | ||
const vertices = []; | ||
@@ -209,4 +211,8 @@ const indices = []; | ||
size: vertexSize, | ||
indexes | ||
indexes, | ||
count | ||
} = this.triangulation(feature, segmentNumber); | ||
if (typeof count === "number") { | ||
vecticesCount += count; | ||
} | ||
indicesForCurrentFeature.forEach((i) => { | ||
@@ -263,3 +269,4 @@ indices.push(i + verticesNum); | ||
attributes, | ||
elements | ||
elements, | ||
count: vecticesCount | ||
}; | ||
@@ -266,0 +273,0 @@ return this.attributesAndIndices; |
@@ -112,3 +112,4 @@ var __create = Object.create; | ||
this.setCanvas(); | ||
await this.rendererService.init(this.canvas, this.configService.getSceneConfig(this.id)); | ||
await this.rendererService.init(this.canvas, this.configService.getSceneConfig(this.id), sceneConfig.gl); | ||
this.initContainer(); | ||
(0, import_element_resize_event.default)(this.$container, this.handleWindowResized); | ||
@@ -151,3 +152,3 @@ if (import_l7_utils.$window.matchMedia) { | ||
if (this.$container) { | ||
await this.rendererService.init(sceneConfig.canvas, this.configService.getSceneConfig(this.id)); | ||
await this.rendererService.init(sceneConfig.canvas, this.configService.getSceneConfig(this.id), void 0); | ||
} else { | ||
@@ -154,0 +155,0 @@ console.error("\u5BB9\u5668 id \u4E0D\u5B58\u5728"); |
@@ -57,3 +57,3 @@ var __create = Object.create; | ||
var globalDefaultprecision = "#ifdef GL_FRAGMENT_PRECISION_HIGH\n precision highp float;\n #else\n precision mediump float;\n#endif\n"; | ||
var includeRegExp = /#pragma include (["^+"]?["\ "[a-zA-Z_0-9](.*)"]*?)/g; | ||
var includeRegExp = /#pragma include (["^+"]?["[a-zA-Z_0-9](.*)"]*?)/g; | ||
var ShaderModuleService = class { | ||
@@ -60,0 +60,0 @@ constructor() { |
{ | ||
"name": "@antv/l7-core", | ||
"version": "2.9.23", | ||
"version": "2.9.24", | ||
"description": "", | ||
@@ -28,3 +28,3 @@ "main": "lib/index.js", | ||
"@antv/async-hook": "^2.1.0", | ||
"@antv/l7-utils": "2.9.23", | ||
"@antv/l7-utils": "2.9.24", | ||
"@babel/runtime": "^7.7.7", | ||
@@ -52,3 +52,3 @@ "@turf/helpers": "^6.1.4", | ||
}, | ||
"gitHead": "b8bef9861bce80ff9b27a53d7bfb386c74005087", | ||
"gitHead": "0d84d477dc449e4541bdcaabbb29e6765d37b079", | ||
"publishConfig": { | ||
@@ -55,0 +55,0 @@ "access": "public" |
819179
17625
+ Added@antv/l7-utils@2.9.24(transitive)
- Removed@antv/l7-utils@2.9.23(transitive)
Updated@antv/l7-utils@2.9.24