mirror of
https://github.com/overte-org/overte.git
synced 2025-08-10 04:12:46 +02:00
Add new zone button
This commit is contained in:
parent
4e2bcc0690
commit
3dfbd70d41
1 changed files with 25 additions and 0 deletions
|
@ -135,6 +135,7 @@ var toolBar = (function () {
|
||||||
newSphereButton,
|
newSphereButton,
|
||||||
newLightButton,
|
newLightButton,
|
||||||
newTextButton,
|
newTextButton,
|
||||||
|
newZoneButton,
|
||||||
browseMarketplaceButton;
|
browseMarketplaceButton;
|
||||||
|
|
||||||
function initialize() {
|
function initialize() {
|
||||||
|
@ -201,6 +202,14 @@ var toolBar = (function () {
|
||||||
alpha: 0.9,
|
alpha: 0.9,
|
||||||
visible: false
|
visible: false
|
||||||
});
|
});
|
||||||
|
newZoneButton = toolBar.addTool({
|
||||||
|
imageURL: toolIconUrl + "zonecube3.svg",
|
||||||
|
subImage: { x: 0, y: Tool.IMAGE_WIDTH + 208, width: 256, height: 256 },
|
||||||
|
width: toolWidth,
|
||||||
|
height: toolHeight,
|
||||||
|
alpha: 0.9,
|
||||||
|
visible: false
|
||||||
|
});
|
||||||
|
|
||||||
that.setActive(false);
|
that.setActive(false);
|
||||||
}
|
}
|
||||||
|
@ -241,6 +250,7 @@ var toolBar = (function () {
|
||||||
toolBar.showTool(newSphereButton, doShow);
|
toolBar.showTool(newSphereButton, doShow);
|
||||||
toolBar.showTool(newLightButton, doShow);
|
toolBar.showTool(newLightButton, doShow);
|
||||||
toolBar.showTool(newTextButton, doShow);
|
toolBar.showTool(newTextButton, doShow);
|
||||||
|
toolBar.showTool(newZoneButton, doShow);
|
||||||
};
|
};
|
||||||
|
|
||||||
var RESIZE_INTERVAL = 50;
|
var RESIZE_INTERVAL = 50;
|
||||||
|
@ -412,6 +422,21 @@ var toolBar = (function () {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (newZoneButton === toolBar.clicked(clickedOverlay)) {
|
||||||
|
var position = getPositionToCreateEntity();
|
||||||
|
|
||||||
|
if (position.x > 0 && position.y > 0 && position.z > 0) {
|
||||||
|
placingEntityID = Entities.addEntity({
|
||||||
|
type: "Zone",
|
||||||
|
position: grid.snapToSurface(grid.snapToGrid(position, false, DEFAULT_DIMENSIONS), DEFAULT_DIMENSIONS),
|
||||||
|
dimensions: { x: 10, y: 10, z: 10 },
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
print("Can't create box: Text would be out of bounds.");
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue