From d74957a902a6f5cb0450edd29528dd98df3046ad Mon Sep 17 00:00:00 2001 From: YiQianYao <42212176+yiiiiiiqianyao@users.noreply.github.com> Date: Sun, 9 Oct 2022 19:22:20 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E6=8B=BE=E5=8F=96?= =?UTF-8?q?=E9=AB=98=E4=BA=AE=E7=8A=B6=E6=80=81=E5=BC=82=E5=B8=B8=20(#1368?= =?UTF-8?q?)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix: 修复 featureScale 错误 * style: lint style * fix: remove featureScalePlugin async * fix: 修复拾取高亮状态异常 Co-authored-by: shihui --- dev-demos/features/fix/demos/fix.tsx | 79 +++---------------- .../services/interaction/PickingService.ts | 11 --- 2 files changed, 11 insertions(+), 79 deletions(-) diff --git a/dev-demos/features/fix/demos/fix.tsx b/dev-demos/features/fix/demos/fix.tsx index 945c7c4dd7..04362b432a 100644 --- a/dev-demos/features/fix/demos/fix.tsx +++ b/dev-demos/features/fix/demos/fix.tsx @@ -34,49 +34,9 @@ export default () => { type: "Polygon", coordinates: [ [ - [113.8623046875, 31.031055426540206], - [116.3232421875, 32.031055426540206], - [116.3232421875, 32.590574094954192] - ] - ] - } - }, - { - type: "Feature", - properties: { - color: "#ff0", - name: "北京" - }, - geometry: { - type: "Polygon", - coordinates: [ - [ - [111.8623046875, 30.031055426540206], - [112.3232421875, 30.031055426540206], - [113.3232421875, 31.090574094954192] - ] - ] - } - } - ] - }; - - const geo2 = { - type: "FeatureCollection", - features: [ - { - type: "Feature", - properties: { - color: "#f00", - name: "杭州" - }, - geometry: { - type: "Polygon", - coordinates: [ - [ - [113.8623046875, 31.031055426540206], - [116.3232421875, 32.031055426540206], - [116.3232421875, 32.590574094954192] + [100, 30], + [120, 35], + [120, 30] ] ] } @@ -85,35 +45,18 @@ export default () => { }; const layer = new PolygonLayer() - .source(geo, { - transforms: [ - { - type: "join", - sourceField: "name", //data1 对应字段名 - targetField: "name", // data 对应字段名 绑定到的地理数据 - data: dataList - } - ] - }) + .source(geo) .shape("fill") - .color("data", (c) => c) + .color("#f00") + // .active(true) + .select(true) scene.on("loaded", () => { scene.addLayer(layer); - - setTimeout(() => { - layer.setData(geo2, { - transforms: [ - { - type: "join", - sourceField: "name", //data1 对应字段名 - targetField: "name", // data 对应字段名 绑定到的地理数据 - data: dataList2 - } - ] - }) - .color("data", (c) => c); - }, 2000); + layer.on('mousemove', () => { + + }) + }); }, []); diff --git a/packages/core/src/services/interaction/PickingService.ts b/packages/core/src/services/interaction/PickingService.ts index 11fc388a7f..c72b358eb4 100644 --- a/packages/core/src/services/interaction/PickingService.ts +++ b/packages/core/src/services/interaction/PickingService.ts @@ -43,9 +43,6 @@ export default class PickingService implements IPickingService { private pickBufferScale: number = 1.0; - // Tip: 记录当前拾取中的 layers - private pickedLayers: ILayer[] = []; - public init(id: string) { const { createTexture2D, @@ -252,7 +249,6 @@ export default class PickingService implements IPickingService { // trigger onHover/Click callback on layer isPicked = true; layer.setCurrentPickId(pickedFeatureIdx); - this.pickedLayers = [layer]; this.triggerHoverOnLayer(layer, layerTarget); // 触发拾取事件 } } else { @@ -275,7 +271,6 @@ export default class PickingService implements IPickingService { }); this.triggerHoverOnLayer(layer, layerTarget); layer.setCurrentPickId(null); - this.pickedLayers = []; } if (enableHighlight) { @@ -382,12 +377,6 @@ export default class PickingService implements IPickingService { depth: 1, }); - // Tip: clear last picked layer state - this.pickedLayers - .filter((pickedlayer) => !pickedlayer.isVector) - .map((pickedlayer) => { - this.selectFeature(pickedlayer, new Uint8Array([0, 0, 0, 0])); - }); // Tip: clear last picked tilelayer state this.pickedTileLayers.map((pickedTileLayer) => (pickedTileLayer.tileLayer as ITileLayer)?.clearPick(target.type),