Removed old toolbar

This commit is contained in:
Atlante45 2014-05-13 14:34:08 -07:00
parent 57343be200
commit 701bc63bd1

View file

@ -18,7 +18,7 @@ var toolWidth = 50;
var LASER_WIDTH = 4;
var LASER_COLOR = { red: 255, green: 0, blue: 0 };
var LASER_LENGTH_FACTOR = 1.5;
var LASER_LENGTH_FACTOR = 5;
var LEFT = 0;
var RIGHT = 1;
@ -368,20 +368,6 @@ function checkController(deltaTime) {
moveOverlays();
}
var clickEvent = false;
var newModel;
var modifierType = -1;
var moveYZ;
var moveXZ;
var moveXY;
var yaw;
var pitch;
var roll;
var scale;
var modelSelected = false;
var selectedModelID;
var selectedModelProperties;
function initToolBar() {
@ -394,68 +380,6 @@ function initToolBar() {
visible: true,
alpha: 0.9
});
print("New Model: " + newModel)
// Move YZ
moveYZ = toolBar.addTool({
imageURL: toolIconUrl + "voxel-tool.svg",
subImage: { x: 0, y: 0, width: Tool.IMAGE_WIDTH, height: Tool.IMAGE_HEIGHT },
width: toolWidth, height: toolHeight,
visible: true,
alpha: 0.9
}, true);
// Move XZ
moveXZ = toolBar.addTool({
imageURL: toolIconUrl + "voxel-tool.svg",
subImage: { x: 0, y: 0, width: Tool.IMAGE_WIDTH, height: Tool.IMAGE_HEIGHT },
width: toolWidth, height: toolHeight,
visible: true,
alpha: 0.9
}, true);
// Move XY
moveXY = toolBar.addTool({
imageURL: toolIconUrl + "voxel-tool.svg",
subImage: { x: 0, y: 0, width: Tool.IMAGE_WIDTH, height: Tool.IMAGE_HEIGHT },
width: toolWidth, height: toolHeight,
visible: true,
alpha: 0.9
}, true);
// Yaw
yaw = toolBar.addTool({
imageURL: toolIconUrl + "voxel-tool.svg",
subImage: { x: 0, y: 0, width: Tool.IMAGE_WIDTH, height: Tool.IMAGE_HEIGHT },
width: toolWidth, height: toolHeight,
visible: true,
alpha: 0.9
}, true);
// Pitch
pitch = toolBar.addTool({
imageURL: toolIconUrl + "voxel-tool.svg",
subImage: { x: 0, y: 0, width: Tool.IMAGE_WIDTH, height: Tool.IMAGE_HEIGHT },
width: toolWidth, height: toolHeight,
visible: true,
alpha: 0.9
}, true);
// Roll
roll = toolBar.addTool({
imageURL: toolIconUrl + "voxel-tool.svg",
subImage: { x: 0, y: 0, width: Tool.IMAGE_WIDTH, height: Tool.IMAGE_HEIGHT },
width: toolWidth, height: toolHeight,
visible: true,
alpha: 0.9
}, true);
// Scale
scale = toolBar.addTool({
imageURL: toolIconUrl + "voxel-tool.svg",
subImage: { x: 0, y: 0, width: Tool.IMAGE_WIDTH, height: Tool.IMAGE_HEIGHT },
width: toolWidth, height: toolHeight,
visible: true,
alpha: 0.9
}, true);
}
function moveOverlays() {
@ -475,74 +399,39 @@ function moveOverlays() {
toolBar.move(toolsX, toolsY);
}
var modelSelected = false;
var selectedModelID;
var selectedModelProperties;
function mousePressEvent(event) {
modelSelected = false;
var modelSelected = false;
var clickedOverlay = Overlays.getOverlayAtPoint({x: event.x, y: event.y});
if (clickedOverlay != 0) {
var index = toolBar.clicked(clickedOverlay);
switch(index) {
case newModel:
var url = Window.prompt("Model url", modelURLs[Math.floor(Math.random() * modelURLs.length)]);
if (url == null) {
return;
}
var position = Vec3.sum(MyAvatar.position, Vec3.multiply(Quat.getFront(MyAvatar.orientation), SPAWN_DISTANCE));
Models.addModel({ position: position,
radius: radiusDefault,
modelURL: url
});
break;
case moveYZ:
print("Selected moveYZ");
break;
case moveXZ:
print("Selected moveXZ");
break;
case moveXY:
print("Selected moveXY");
break;
case yaw:
print("Selected yaw");
break;
case pitch:
print("Selected pitch");
break;
case roll:
print("Selected roll");
break;
case scale:
print("Selected scale");
break;
default:
clickEvent = false;
return;
if (newModel == toolBar.clicked(clickedOverlay)) {
var url = Window.prompt("Model url", modelURLs[Math.floor(Math.random() * modelURLs.length)]);
if (url == null) {
return;
}
clickEvent = true;
if (modifierType != -1) {
toolBar.tools[modifierType].select(false);
}
modifierType = index;
var position = Vec3.sum(MyAvatar.position, Vec3.multiply(Quat.getFront(MyAvatar.orientation), SPAWN_DISTANCE));
Models.addModel({ position: position,
radius: radiusDefault,
modelURL: url
});
} else {
var pickRay = Camera.computePickRay(event.x, event.y);
Vec3.print("Looking at: ", pickRay.origin);
Vec3.print("[Mouse] Looking at: ", pickRay.origin);
var foundModels = Models.findModels(pickray.origin, LASER_LENGTH_FACTOR);
print("Num: " + foundModels.length.toString());
for (var i = 0; i < foundModels.length; i++) {
if (!foundModels[i].isKnownID) {
var identify = Models.identifyModel(foundModels[i]);
if (!identify.isKnownID) {
print("Unknown ID " + identify.id + "(update loop)");
return;
continue;
}
foundModels[i] = identify;
}
@ -580,41 +469,11 @@ function mousePressEvent(event) {
}
function mouseMoveEvent(event) {
if (clickEvent && !modelSelected) {
if (!modelSelected) {
return;
}
print("Dragging");
switch(modifierType) {
case moveYZ:
print("Move " + moveYZ);
break;
case moveXZ:
print("Move " + moveXZ);
break;
case moveXY:
print("Move " + moveXY);
break;
case yaw:
print("Move " + yaw);
break;
case pitch:
print("Move " + pitch);
break;
case roll:
print("Move " + roll);
break;
case scale:
print("Move " + scale);
break;
}
Model.editModel(selectedModelID, selectedModelProperties);
}