Skip to content

Commit

Permalink
Adding prompts for corner x, y location apart form elevation
Browse files Browse the repository at this point in the history
  • Loading branch information
aalavandhaann committed Jun 13, 2019
1 parent 390ad71 commit 91d8dd5
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 25 deletions.
2 changes: 1 addition & 1 deletion build/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
<span class="glyphicon glyphicon-remove"></span>
</button>
<button id="help2d" class="btn btn-sm btn-default"
title="Tips&#10;Shift Key: Snap To Axis&#10;ESC: Stop drawing walls&#10;DbL-Click(Corner): Adjust Elevation">
title="Tips&#10;Shift Key: Snap To Axis&#10;ESC: Stop drawing walls&#10;DbL-Click(Corner): Adjust Elevation&#10;;DbL-Click(Room): Change Name&#10;">
<span class="glyphicon glyphicon-info-sign"></span>
</button>
</div>
Expand Down
50 changes: 35 additions & 15 deletions build/js/bp3djs.js
Original file line number Diff line number Diff line change
Expand Up @@ -117889,24 +117889,44 @@ var BP3DJS = (function (exports) {
key: 'doubleclick',
value: function doubleclick() {
var userinput, cid;
var units = Configuration.getStringValue(configDimUnit);
function getAValidInput(message, current) {
console.log('GET A VALID INPUT');
var uinput = window.prompt(message, current);
if (uinput != null) {
return uinput;
}
return current;
}
if (this.activeCorner) {
this.floorplan.dispatchEvent({ type: EVENT_CORNER_2D_DOUBLE_CLICKED, item: this.activeCorner });
cid = this.activeCorner.id;
userinput = window.prompt('Elevation at this point (in ' + units + ',\n' + cid + '): ', Dimensioning.cmToMeasureRaw(this.activeCorner.elevation));
if (userinput != null) {
this.activeCorner.elevation = Number(userinput);
}
} else if (this.activeWall) {
this.floorplan.dispatchEvent({ type: EVENT_WALL_2D_DOUBLE_CLICKED, item: this.activeWall });
} else if (this.activeRoom) {
this.floorplan.dispatchEvent({ type: EVENT_ROOM_2D_DOUBLE_CLICKED, item: this.activeRoom });
userinput = window.prompt('Enter a name for this Room: ', this.activeRoom.name);
if (userinput != null) {
this.activeRoom.name = userinput;
}
this.view.draw();
var units = Configuration.getStringValue(configDimUnit);
this.activeCorner.elevation = getAValidInput('Elevation at this point (in ' + units + ',\n' + cid + '): ', Dimensioning.cmToMeasureRaw(this.activeCorner.elevation)); //Number(userinput);
var x = getAValidInput('Location: X (' + Dimensioning.cmToMeasureRaw(this.activeCorner.x) + '): ', Dimensioning.cmToMeasureRaw(this.activeCorner.x)); //Number(userinput);
var y = getAValidInput('Location: Y (' + Dimensioning.cmToMeasureRaw(this.activeCorner.y) + '): ', Dimensioning.cmToMeasureRaw(this.activeCorner.y)); //Number(userinput);
this.activeCorner.move(Dimensioning.cmFromMeasureRaw(x), Dimensioning.cmFromMeasureRaw(y));
this.floorplan.dispatchEvent({ type: EVENT_CORNER_2D_DOUBLE_CLICKED, item: this.activeCorner });
}
// var userinput, cid;
// var units = Configuration.getStringValue(configDimUnit);
// if(this.activeCorner)
// {
// this.floorplan.dispatchEvent({type:EVENT_CORNER_2D_DOUBLE_CLICKED, item: this.activeCorner});
// cid = this.activeCorner.id;
// userinput = window.prompt(`Elevation at this point (in ${units},\n${cid}): `, Dimensioning.cmToMeasureRaw(this.activeCorner.elevation));
// if(userinput != null)
// {
// this.activeCorner.elevation = Number(userinput);
// }
else if (this.activeWall) {
this.floorplan.dispatchEvent({ type: EVENT_WALL_2D_DOUBLE_CLICKED, item: this.activeWall });
} else if (this.activeRoom) {
this.floorplan.dispatchEvent({ type: EVENT_ROOM_2D_DOUBLE_CLICKED, item: this.activeRoom });
userinput = window.prompt('Enter a name for this Room: ', this.activeRoom.name);
if (userinput != null) {
this.activeRoom.name = userinput;
}
this.view.draw();
}
}
}, {
key: 'keyUp',
Expand Down
2 changes: 1 addition & 1 deletion build/js/bp3djs.min.js

Large diffs are not rendered by default.

35 changes: 27 additions & 8 deletions src/scripts/floorplanner/floorplanner.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,18 +97,37 @@ export class Floorplanner2D extends EventDispatcher
doubleclick()
{
var userinput, cid;
var units = Configuration.getStringValue(configDimUnit);
function getAValidInput(message, current)
{
console.log('GET A VALID INPUT');
var uinput = window.prompt(message, current);
if(uinput != null)
{
return uinput;
}
return current;
}
if(this.activeCorner)
{
this.floorplan.dispatchEvent({type:EVENT_CORNER_2D_DOUBLE_CLICKED, item: this.activeCorner});
cid = this.activeCorner.id;
userinput = window.prompt(`Elevation at this point (in ${units},\n${cid}): `, Dimensioning.cmToMeasureRaw(this.activeCorner.elevation));
if(userinput != null)
{
this.activeCorner.elevation = Number(userinput);
}

var units = Configuration.getStringValue(configDimUnit);
this.activeCorner.elevation = getAValidInput(`Elevation at this point (in ${units},\n${cid}): `, Dimensioning.cmToMeasureRaw(this.activeCorner.elevation));//Number(userinput);
var x = getAValidInput(`Location: X (${Dimensioning.cmToMeasureRaw(this.activeCorner.x)}): `, Dimensioning.cmToMeasureRaw(this.activeCorner.x));//Number(userinput);
var y = getAValidInput(`Location: Y (${Dimensioning.cmToMeasureRaw(this.activeCorner.y)}): `, Dimensioning.cmToMeasureRaw(this.activeCorner.y));//Number(userinput);
this.activeCorner.move(Dimensioning.cmFromMeasureRaw(x), Dimensioning.cmFromMeasureRaw(y));
this.floorplan.dispatchEvent({type:EVENT_CORNER_2D_DOUBLE_CLICKED, item: this.activeCorner});
}
// var userinput, cid;
// var units = Configuration.getStringValue(configDimUnit);
// if(this.activeCorner)
// {
// this.floorplan.dispatchEvent({type:EVENT_CORNER_2D_DOUBLE_CLICKED, item: this.activeCorner});
// cid = this.activeCorner.id;
// userinput = window.prompt(`Elevation at this point (in ${units},\n${cid}): `, Dimensioning.cmToMeasureRaw(this.activeCorner.elevation));
// if(userinput != null)
// {
// this.activeCorner.elevation = Number(userinput);
// }
else if(this.activeWall)
{
this.floorplan.dispatchEvent({type:EVENT_WALL_2D_DOUBLE_CLICKED, item: this.activeWall});
Expand Down

0 comments on commit 91d8dd5

Please sign in to comment.