make voxels.js buttons work, again

This commit is contained in:
Seth Alves 2016-03-20 17:40:03 -07:00
parent b8929c4416
commit 21c688390c

View file

@ -16,8 +16,8 @@ var deletingVoxels = false;
var addingSpheres = false; var addingSpheres = false;
var deletingSpheres = false; var deletingSpheres = false;
var offAlpha = 0.5; var offAlpha = 0.8;
var onAlpha = 0.9; var onAlpha = 1.0;
var editSphereRadius = 4; var editSphereRadius = 4;
function floorVector(v) { function floorVector(v) {
@ -48,52 +48,47 @@ var toolBar = (function () {
height: toolHeight, height: toolHeight,
alpha: onAlpha, alpha: onAlpha,
visible: true, visible: true,
}); }, false);
addVoxelButton = toolBar.addTool({ addVoxelButton = toolBar.addTool({
imageURL: toolIconUrl + "voxel-add.svg", imageURL: toolIconUrl + "voxel-add.svg",
subImage: { x: 0, y: Tool.IMAGE_WIDTH, width: Tool.IMAGE_WIDTH, height: Tool.IMAGE_HEIGHT },
width: toolWidth, width: toolWidth,
height: toolHeight, height: toolHeight,
alpha: offAlpha, alpha: offAlpha,
visible: false visible: false
}); }, false);
deleteVoxelButton = toolBar.addTool({ deleteVoxelButton = toolBar.addTool({
imageURL: toolIconUrl + "voxel-delete.svg", imageURL: toolIconUrl + "voxel-delete.svg",
subImage: { x: 0, y: Tool.IMAGE_WIDTH, width: Tool.IMAGE_WIDTH, height: Tool.IMAGE_HEIGHT },
width: toolWidth, width: toolWidth,
height: toolHeight, height: toolHeight,
alpha: offAlpha, alpha: offAlpha,
visible: false visible: false
}); }, false);
addSphereButton = toolBar.addTool({ addSphereButton = toolBar.addTool({
imageURL: toolIconUrl + "sphere-add.svg", imageURL: toolIconUrl + "sphere-add.svg",
subImage: { x: 0, y: Tool.IMAGE_WIDTH, width: Tool.IMAGE_WIDTH, height: Tool.IMAGE_HEIGHT },
width: toolWidth, width: toolWidth,
height: toolHeight, height: toolHeight,
alpha: offAlpha, alpha: offAlpha,
visible: false visible: false
}); }, false);
deleteSphereButton = toolBar.addTool({ deleteSphereButton = toolBar.addTool({
imageURL: toolIconUrl + "sphere-delete.svg", imageURL: toolIconUrl + "sphere-delete.svg",
subImage: { x: 0, y: Tool.IMAGE_WIDTH, width: Tool.IMAGE_WIDTH, height: Tool.IMAGE_HEIGHT },
width: toolWidth, width: toolWidth,
height: toolHeight, height: toolHeight,
alpha: offAlpha, alpha: offAlpha,
visible: false visible: false
}); }, false);
addTerrainButton = toolBar.addTool({ addTerrainButton = toolBar.addTool({
imageURL: toolIconUrl + "voxel-terrain.svg", imageURL: toolIconUrl + "voxel-terrain.svg",
subImage: { x: 0, y: Tool.IMAGE_WIDTH, width: Tool.IMAGE_WIDTH, height: Tool.IMAGE_HEIGHT },
width: toolWidth, width: toolWidth,
height: toolHeight, height: toolHeight,
alpha: onAlpha, alpha: onAlpha,
visible: false visible: false
}); }, false);
that.setActive(false); that.setActive(false);
} }
@ -193,7 +188,6 @@ var toolBar = (function () {
that.cleanup = function () { that.cleanup = function () {
toolBar.cleanup(); toolBar.cleanup();
// Overlays.deleteOverlay(activeButton);
}; };
@ -456,9 +450,6 @@ function keyReleaseEvent(event) {
function cleanup() { function cleanup() {
for (var i = 0; i < overlays.length; i++) {
Overlays.deleteOverlay(overlays[i]);
}
toolBar.cleanup(); toolBar.cleanup();
} }