Auto-size load URL and file menu items in editModels and newEditEntities

And fix a couple of typos.
This commit is contained in:
David Rowe 2014-11-07 08:59:37 -08:00
parent 7e6d616f20
commit 8c3360d0a9
2 changed files with 18 additions and 12 deletions

View file

@ -1125,12 +1125,12 @@ var toolBar = (function () {
browseModelsButton,
loadURLMenuItem,
loadFileMenuItem,
menuItemWidth = 125,
menuItemWidth,
menuItemOffset,
menuItemHeight,
menuItemMargin = 5,
menuTextColor = { red: 255, green: 255, blue: 255 },
menuBackgoundColor = { red: 18, green: 66, blue: 66 };
menuBackgroundColor = { red: 18, green: 66, blue: 66 };
function initialize() {
toolBar = new ToolBar(0, 0, ToolBar.VERTICAL);
@ -1167,9 +1167,8 @@ var toolBar = (function () {
loadURLMenuItem = Overlays.addOverlay("text", {
x: newModelButton.x - menuItemWidth,
y: newModelButton.y + menuItemOffset,
width: menuItemWidth,
height: menuItemHeight,
backgroundColor: menuBackgoundColor,
backgroundColor: menuBackgroundColor,
topMargin: menuItemMargin,
text: "Model URL",
alpha: 0.9,
@ -1179,15 +1178,19 @@ var toolBar = (function () {
loadFileMenuItem = Overlays.addOverlay("text", {
x: newModelButton.x - menuItemWidth,
y: newModelButton.y + menuItemOffset + menuItemHeight,
width: menuItemWidth,
height: menuItemHeight,
backgroundColor: menuBackgoundColor,
backgroundColor: menuBackgroundColor,
topMargin: menuItemMargin,
text: "Model File",
alpha: 0.9,
visible: false
});
menuItemWidth = Math.max(Overlays.textWidth(loadURLMenuItem, "Model URL"),
Overlays.textWidth(loadFileMenuItem, "Model File")) + 20;
Overlays.editOverlay(loadURLMenuItem, { width: menuItemWidth });
Overlays.editOverlay(loadFileMenuItem, { width: menuItemWidth });
newCubeButton = toolBar.addTool({
imageURL: toolIconUrl + "add-cube.svg",
subImage: { x: 0, y: Tool.IMAGE_WIDTH, width: Tool.IMAGE_WIDTH, height: Tool.IMAGE_HEIGHT },

View file

@ -83,12 +83,12 @@ var toolBar = (function () {
browseModelsButton,
loadURLMenuItem,
loadFileMenuItem,
menuItemWidth = 125,
menuItemWidth,
menuItemOffset,
menuItemHeight,
menuItemMargin = 5,
menuTextColor = { red: 255, green: 255, blue: 255 },
menuBackgoundColor = { red: 18, green: 66, blue: 66 };
menuBackgroundColor = { red: 18, green: 66, blue: 66 };
function initialize() {
toolBar = new ToolBar(0, 0, ToolBar.VERTICAL);
@ -125,9 +125,8 @@ var toolBar = (function () {
loadURLMenuItem = Overlays.addOverlay("text", {
x: newModelButton.x - menuItemWidth,
y: newModelButton.y + menuItemOffset,
width: menuItemWidth,
height: menuItemHeight,
backgroundColor: menuBackgoundColor,
backgroundColor: menuBackgroundColor,
topMargin: menuItemMargin,
text: "Model URL",
alpha: 0.9,
@ -137,15 +136,19 @@ var toolBar = (function () {
loadFileMenuItem = Overlays.addOverlay("text", {
x: newModelButton.x - menuItemWidth,
y: newModelButton.y + menuItemOffset + menuItemHeight,
width: menuItemWidth,
height: menuItemHeight,
backgroundColor: menuBackgoundColor,
backgroundColor: menuBackgroundColor,
topMargin: menuItemMargin,
text: "Model File",
alpha: 0.9,
visible: false
});
menuItemWidth = Math.max(Overlays.textWidth(loadURLMenuItem, "Model URL"),
Overlays.textWidth(loadFileMenuItem, "Model File")) + 20;
Overlays.editOverlay(loadURLMenuItem, { width: menuItemWidth });
Overlays.editOverlay(loadFileMenuItem, { width: menuItemWidth });
newCubeButton = toolBar.addTool({
imageURL: toolIconUrl + "add-cube.svg",
subImage: { x: 0, y: Tool.IMAGE_WIDTH, width: Tool.IMAGE_WIDTH, height: Tool.IMAGE_HEIGHT },