fix(viewer-lib): Added relative epsilon to section outlines. Added constant epsilon to setting orbit controls position and target (#4781)
This commit is contained in:
committed by
GitHub
parent
3b08570f57
commit
daefbbf2a3
@@ -316,7 +316,11 @@ export class SmoothOrbitControls extends SpeckleControls {
|
||||
*/
|
||||
const targetPosition = this.getPosition()
|
||||
const targetTarget = this.getTarget()
|
||||
if (position.equals(targetPosition) && target.equals(targetTarget)) return
|
||||
const deltaTarget = vector3.subVectors(target, targetTarget).length()
|
||||
const deltaPosition = vector3.subVectors(position, targetPosition).length()
|
||||
const epsilon = 1e-7
|
||||
if (deltaPosition < epsilon) return
|
||||
if (deltaTarget < epsilon) return
|
||||
|
||||
const v0 = new Vector3().copy(position)
|
||||
const v1 = new Vector3().copy(target)
|
||||
|
||||
@@ -356,12 +356,13 @@ export class SectionOutlines extends Extension {
|
||||
|
||||
private setSectionPlaneChanged(planes: Plane[]) {
|
||||
this.sectionPlanesChanged.length = 0
|
||||
const epsilon = this.viewer.World.getRelativeOffset(0.0001)
|
||||
for (let k = 0; k < planes.length; k++) {
|
||||
if (
|
||||
Math.abs(this.lastSectionPlanes[k].constant - planes[k].constant) > 0.0001 ||
|
||||
Math.abs(this.lastSectionPlanes[k].constant - planes[k].constant) > epsilon ||
|
||||
Math.abs(
|
||||
this.lastSectionPlanes[k].normal.length() - planes[k].normal.length()
|
||||
) > 0.0001
|
||||
) > epsilon
|
||||
)
|
||||
this.sectionPlanesChanged.push(planes[k])
|
||||
this.lastSectionPlanes[k].copy(planes[k])
|
||||
|
||||
Reference in New Issue
Block a user