Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(react-components): Smaller adjustment in clipping and measurement after meeting with user #4718

Merged
merged 2 commits into from
Aug 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ export class SliceDomainObject extends PlaneDomainObject {

public constructor(primitiveType: PrimitiveType) {
super(primitiveType);
this.color = new Color(Color.NAMES.greenyellow);
this.backSideColor = new Color(Color.NAMES.red);
this.color = new Color(Color.NAMES.orangered);
this.backSideColor = new Color(Color.NAMES.palegreen);
}

// ==================================================
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ export class LineView extends GroupThreeView<LineDomainObject> {
return undefined; // Should never be picked
}
// Implement the intersection logic here, because of bug in tree.js
const radius = getRadius(domainObject, style);
const radius = getSelectRadius(domainObject, style);
if (radius <= 0) {
return;
}
Expand All @@ -108,7 +108,7 @@ export class LineView extends GroupThreeView<LineDomainObject> {
const thisPoint = new Vector3();
const intersection = new Vector3();

const radiusSquared = square(1.5 * radius); // Add 50% more to make it easier to pick
const radiusSquared = square(radius);
const ray = intersectInput.raycaster.ray;
const closestFinder = new ClosestGeometryFinder<DomainObjectIntersection>(ray.origin);

Expand Down Expand Up @@ -341,3 +341,7 @@ function adjustLabel(
function getRadius(domainObject: LineDomainObject, style: LineRenderStyle): number {
return domainObject.isSelected ? style.selectedPipeRadius : style.pipeRadius;
}

function getSelectRadius(domainObject: LineDomainObject, style: LineRenderStyle): number {
return 1.5 * style.selectedPipeRadius; // Added more to make it easier to pick
}
Original file line number Diff line number Diff line change
Expand Up @@ -89,29 +89,36 @@ export class PlaneCreator extends BaseCreator {
throw new Error('Cannot create a plane without points');
}
const domainObject = this._domainObject;
let normal: Vector3;
switch (domainObject.primitiveType) {
case PrimitiveType.PlaneX:
domainObject.plane.setFromNormalAndCoplanarPoint(new Vector3(1, 0, 0), this.firstPoint);
normal = new Vector3(1, 0, 0);
break;

case PrimitiveType.PlaneY:
domainObject.plane.setFromNormalAndCoplanarPoint(new Vector3(0, 1, 0), this.firstPoint);
normal = new Vector3(0, 1, 0);
break;

case PrimitiveType.PlaneZ:
domainObject.plane.setFromNormalAndCoplanarPoint(new Vector3(0, 0, 1), this.firstPoint);
normal = new Vector3(0, 0, 1);
break;

case PrimitiveType.PlaneXY:
if (this.pointCount === 1) {
const normal = ray.direction.clone().normalize();
domainObject.plane.setFromNormalAndCoplanarPoint(normal, this.firstPoint);
} else if (this.pointCount === 2) {
const normal = new Vector3().subVectors(this.lastPoint, this.firstPoint).normalize();
normal = ray.direction.clone().normalize();
} else {
normal = new Vector3().subVectors(this.lastPoint, this.firstPoint).normalize();
rotatePiHalf(normal);
domainObject.plane.setFromNormalAndCoplanarPoint(normal, this.firstPoint);
}
break;

default:
return;
}
// Make sure that the normal is pointing towards the camera
if (ray.direction.dot(normal) < 0) {
normal.negate();
}
domainObject.plane.setFromNormalAndCoplanarPoint(normal, this.firstPoint);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ export class PlaneRenderStyle extends CommonRenderStyle {
public linesColor = BLACK_COLOR.clone();
public selectedLinesColor = WHITE_COLOR.clone();
public opacityUse = true;
public opacity = 0.5;
public selectedOpacity = 0.8;
public opacity = 0.25;
public selectedOpacity = 0.5;

// ==================================================
// OVERRIDES of BaseStyle
Expand Down
Loading