Skip to content

Commit

Permalink
updates
Browse files Browse the repository at this point in the history
  • Loading branch information
deyihu committed Oct 29, 2024
1 parent 40e359d commit 6ee96b6
Showing 1 changed file with 16 additions and 8 deletions.
24 changes: 16 additions & 8 deletions src/renderer/layer/vectorlayer/VectorLayerCanvasRenderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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];
}
Expand Down Expand Up @@ -372,20 +368,32 @@ 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'];
const collisionIndex = this.layer.getCollisionIndex();
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]);
}
Expand Down

0 comments on commit 6ee96b6

Please sign in to comment.