From 6ee96b6fa4a2ae86d7b95e4d4a071d511592548e Mon Sep 17 00:00:00 2001 From: deyihu Date: Tue, 29 Oct 2024 22:50:27 +0800 Subject: [PATCH] updates --- .../vectorlayer/VectorLayerCanvasRenderer.ts | 24 ++++++++++++------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/src/renderer/layer/vectorlayer/VectorLayerCanvasRenderer.ts b/src/renderer/layer/vectorlayer/VectorLayerCanvasRenderer.ts index 62628c6dd..de93329fd 100644 --- a/src/renderer/layer/vectorlayer/VectorLayerCanvasRenderer.ts +++ b/src/renderer/layer/vectorlayer/VectorLayerCanvasRenderer.ts @@ -8,7 +8,7 @@ import * as vec3 from '../../../core/util/vec3'; import Canvas from '../../../core/Canvas'; import type { Painter, CollectionPainter } from '../../geometry'; import { Point } from '../../../geo'; -import { Geometries } from '../../../geometry'; +import { Geometries, Marker } from '../../../geometry'; import type { WithUndef } from '../../../types/typings'; const TEMP_EXTENT = new PointExtent(); @@ -81,14 +81,10 @@ class VectorLayerRenderer extends OverlayLayerCanvasRenderer { } const collision = geo.options.collision; if (!collision) { - if (geo.isPoint) { - geo._collided = false; - } return false; } // const type = geo.getType(); if (geo.isPoint && geo.getContainerExtent) { - geo._collided = false; if (!geo.bbox) { geo.bbox = [0, 0, 0, 0]; } @@ -372,8 +368,16 @@ class VectorLayerRenderer extends OverlayLayerCanvasRenderer { //@internal _collidesGeos() { + const geos = this._geosToDraw; const collision = this.layer.options['collision']; if (!collision) { + //reset points _collided + for (let i = 0, len = geos.length; i < len; i++) { + const geo = geos[i]; + if (geo.isPoint) { + (geo as Marker)._collided = false; + } + } return this; } const collisionScope = this.layer.options['collisionScope']; @@ -381,11 +385,15 @@ class VectorLayerRenderer extends OverlayLayerCanvasRenderer { if (collisionScope === 'layer') { collisionIndex.clear(); } - const geos = this._geosToDraw; this._geosToDraw = []; for (let i = 0, len = geos.length; i < len; i++) { - if (this._geoIsCollision(geos[i], collisionIndex)) { - continue; + const geo = geos[i]; + if (geo.isPoint) { + (geo as Marker)._collided = false; + if (this._geoIsCollision(geo, collisionIndex)) { + (geo as Marker)._collided = true; + continue; + } } this._geosToDraw.push(geos[i]); }