Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
public update(calc: BotCalculationContext) {
if (!this._wallObject) return;
let sourceWorkspace = this._getWorkspace(this._sourceBot3d);
let targetWorkspace = this._getWorkspace(this._targetBot3d);
const sourceMinimized =
sourceWorkspace && isMinimized(calc, sourceWorkspace.bot);
const targetMinimized =
targetWorkspace && isMinimized(calc, targetWorkspace.bot);
if (sourceMinimized && targetMinimized) {
// The workspace of both the source bot and target bot are minimized. Hide wall and do nothing else.
this._wallObject.visible = false;
} else {
this._wallObject.visible = true;
// Update wall origin.
if (sourceWorkspace instanceof BuilderGroup3D && sourceMinimized) {
let miniHexSphere =
sourceWorkspace.surface.miniHex.boundingSphere;
this.setOrigin(miniHexSphere.center, true);
} else {
let sourceSphere = this._sourceBot3d.boundingSphere;
public update(calc: BotCalculationContext) {
if (!this._wallObject) return;
let sourceWorkspace = this._getWorkspace(this._sourceBot3d);
let targetWorkspace = this._getWorkspace(this._targetBot3d);
const sourceMinimized =
sourceWorkspace && isMinimized(calc, sourceWorkspace.bot);
const targetMinimized =
targetWorkspace && isMinimized(calc, targetWorkspace.bot);
if (sourceMinimized && targetMinimized) {
// The workspace of both the source bot and target bot are minimized. Hide wall and do nothing else.
this._wallObject.visible = false;
} else {
this._wallObject.visible = true;
// Update wall origin.
if (sourceWorkspace instanceof BuilderGroup3D && sourceMinimized) {
let miniHexSphere =
sourceWorkspace.surface.miniHex.boundingSphere;
this.setOrigin(miniHexSphere.center, true);
} else {
let sourceSphere = this._sourceBot3d.boundingSphere;
this.setOrigin(sourceSphere.center, true);
}
public update(calc: FileCalculationContext) {
if (!this._arrowHelper) return;
let sourceWorkspace = this._getWorkspace(this._sourceFile3d);
let targetWorkspace = this._getWorkspace(this._targetFile3d);
const sourceMinimized =
sourceWorkspace && isMinimized(calc, sourceWorkspace.file);
const targetMinimized =
targetWorkspace && isMinimized(calc, targetWorkspace.file);
if (sourceMinimized && targetMinimized) {
// The workspace of both the source file and target file are minimized. Hide arrow and do nothing else.
this._arrowHelper.visible = false;
} else {
this._arrowHelper.visible = true;
// Update arrow origin.
if (sourceWorkspace instanceof BuilderGroup3D && sourceMinimized) {
let miniHexSphere =
sourceWorkspace.surface.miniHex.boundingSphere;
this.setOrigin(miniHexSphere.center, true);
} else {
let sourceSphere = this._sourceFile3d.boundingSphere;
public update(calc: FileCalculationContext) {
if (!this._arrowHelper) return;
let sourceWorkspace = this._getWorkspace(this._sourceFile3d);
let targetWorkspace = this._getWorkspace(this._targetFile3d);
const sourceMinimized =
sourceWorkspace && isMinimized(calc, sourceWorkspace.file);
const targetMinimized =
targetWorkspace && isMinimized(calc, targetWorkspace.file);
if (sourceMinimized && targetMinimized) {
// The workspace of both the source file and target file are minimized. Hide arrow and do nothing else.
this._arrowHelper.visible = false;
} else {
this._arrowHelper.visible = true;
// Update arrow origin.
if (sourceWorkspace instanceof BuilderGroup3D && sourceMinimized) {
let miniHexSphere =
sourceWorkspace.surface.miniHex.boundingSphere;
this.setOrigin(miniHexSphere.center, true);
} else {
let sourceSphere = this._sourceFile3d.boundingSphere;
this.setOrigin(sourceSphere.center, true);
}
this.add(this.surface);
}
const pos = getContextPosition(calc, this.file);
this.position.set(pos.x, pos.z, pos.y);
const rot = getContextRotation(calc, this.file);
this.rotation.set(rot.x, rot.y, rot.z);
this.updateMatrixWorld(true);
await this.surface.update(calc, file, this.getFiles());
const mode = getContextVisualizeMode(calc, this.file);
this.display.visible =
(mode === 'surface' || mode === true) &&
!isMinimized(calc, this.file);
}
}
}
protected _onDrag(calc: BotCalculationContext) {
if (this._workspace) {
if (isMinimized(calc, this._workspace.bot)) {
this._onDragWorkspace(calc);
}
} else {
super._onDrag(calc);
}
}
async update(
calc: BotCalculationContext,
workspace?: Bot,
bots?: AuxBot3D[],
force?: boolean
) {
if (!workspace) {
return;
}
const prev = this.workspace;
this.workspace = workspace || prev;
this.visible =
isContext(calc, this.workspace) &&
getContextVisualizeMode(calc, this.workspace) === 'surface';
this.container.visible = !isMinimized(calc, this.workspace);
this.miniHex.visible = !this.container.visible;
let gridUpdate: GridCheckResults = this._debugInfo.gridCheckResults;
if (bots.length > this.botCount) {
this.botCount = bots.length;
force = true;
}
if (this._gridChanged(this.workspace, prev, calc) || force) {
this._updateHexGrid(calc, bots);
if (this._checker) {
gridUpdate = await this._updateSquareGrids(this._checker, calc);
if (this._debugMesh) {
this.remove(this._debugMesh);