From 10c2ce6389d0ff84b292f9ecad69f5fed9adcc28 Mon Sep 17 00:00:00 2001 From: Val Erastov Date: Wed, 17 Feb 2016 00:30:16 -0800 Subject: [PATCH] working on dock UI --- web/app/app-init.js | 3 +- web/app/sketcher/main2d.js | 33 ++++++++++++++- web/app/ui.js | 84 +++++++++++++++++++++++++++++++++++--- web/css/app.css | 74 ++++++++++++++++++++++----------- web/sketcher.html | 16 ++------ 5 files changed, 166 insertions(+), 44 deletions(-) diff --git a/web/app/app-init.js b/web/app/app-init.js index 1304047b..6459197a 100644 --- a/web/app/app-init.js +++ b/web/app/app-init.js @@ -35,7 +35,7 @@ function start() { } var pm = app.viewer.parametricManager; - var constrList = new TCAD.ui.List($('#constrs'), { + var constrList = new TCAD.ui.List('constrs', { items : function() { var theItems = []; for (var j = 0; j < pm.subSystems.length; j++) { @@ -76,6 +76,7 @@ function start() { app.viewer.parametricManager.refresh(); } }); + $('.dock-node').append(constrList.ul); app.viewer.parametricManager.listeners.push(function() {constrList.refresh()}); constrList.refresh(); diff --git a/web/app/sketcher/main2d.js b/web/app/sketcher/main2d.js index 3b42823d..22197a05 100644 --- a/web/app/sketcher/main2d.js +++ b/web/app/sketcher/main2d.js @@ -17,6 +17,9 @@ TCAD.App2D = function() { //For debug view this._actionsOrder = []; + this.dock = new TCAD.ui.Dock($('#dock'), $('#status'), TCAD.App2D.viewes); + this.dock.show('Constraints'); + this.registerAction = function(id, desc, action) { app.actions[id] = {id: id, desc: desc, action: action}; app._actionsOrder.push(id); @@ -185,6 +188,33 @@ TCAD.App2D = function() { }); }; +TCAD.App2D.viewes = [ + { + name: 'Layers', + icon: 'bars' + }, + { + name: 'Properties', + icon: 'sliders' + }, + { + name: 'Dimensions', + icon: 'arrows-v' + }, + { + name: 'Settings', + icon: 'wrench' + }, + { + name: 'Constraints', + icon: 'cogs' + } +]; + +TCAD.App2D.faBtn = function(iconName) { + return $('', {class : 'fa fa-'+iconName}); +}; + TCAD.App2D.prototype.fit = function() { var bbox = new TCAD.io.BBox(); @@ -244,7 +274,7 @@ TCAD.App2D.prototype.newSketch = function() { TCAD.App2D.prototype.initSketchManager = function(data, ext) { this._sketchesWin = new TCAD.ui.Window($('#sketchManager')); var app = this; - var sketchesList = new TCAD.ui.List($('#sketchList'), { + var sketchesList = new TCAD.ui.List('sketchList', { items : function() { var theItems = []; for (var name in localStorage) { @@ -273,6 +303,7 @@ TCAD.App2D.prototype.initSketchManager = function(data, ext) { app.openSketch(item.name); } }); + $('#sketchManager').find('.content').append(sketchesList.ul); sketchesList.refresh(); this._sketchesList = sketchesList; }; diff --git a/web/app/ui.js b/web/app/ui.js index 6dca5611..1d5d2cae 100644 --- a/web/app/ui.js +++ b/web/app/ui.js @@ -49,11 +49,10 @@ TCAD.ui.openWin = function(win, mouseEvent) { }; /** @constructor */ -TCAD.ui.List = function(el, model) { - this.ul = el; - this.template = this.ul.html(); - this.ul.empty(); +TCAD.ui.List = function(id, model) { + this.ul = $('