Skip to content

Commit

Permalink
fixed(display): The triggering of pointer events for 3D point geometr…
Browse files Browse the repository at this point in the history
…y was inconsistent across various scenarios.

Signed-off-by: Tim Deubler <tim.deubler@here.com>
  • Loading branch information
TerminalTim committed Nov 29, 2023
1 parent 24a6f42 commit f1a1b57
Showing 1 changed file with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import {GeometryBuffer} from '../GeometryBuffer';
import {Raycaster} from '../../Raycaster';
import {transformMat4} from 'gl-matrix/vec3';
import {Attribute} from '../Attribute';
import {vec3} from '@here/xyz-maps-common';

const extentScale = 32;

Expand Down Expand Up @@ -105,6 +106,7 @@ export class PointBuffer extends TemplateBuffer {
const size = positionAttribute.size;
const t0 = [0, 0, 0];
const t1 = [0, 0, 0];
let intersectionPoint;

let rayOrigin;
let rayDirection;
Expand All @@ -116,6 +118,8 @@ export class PointBuffer extends TemplateBuffer {

offsetX /= scale;
offsetY /= scale;
} else {
intersectionPoint = [0, 0, 0];
}

const m3 = sMat[3];
Expand Down Expand Up @@ -209,7 +213,13 @@ export class PointBuffer extends TemplateBuffer {
rayDirection
);


if (intersectRayLength) {
if (!alignMap) {
vec3.add(intersectionPoint, rayOrigin, vec3.scale(intersectionPoint, rayDirection, intersectRayLength));
intersectRayLength = rayCaster.rayLengthScreenToWorld(intersectionPoint);
}

if (intersectRayLength < result.z) {
result.z = intersectRayLength;
bufferIndex = i;
Expand Down

0 comments on commit f1a1b57

Please sign in to comment.