diff --git a/package.json b/package.json index 55c06a63..2d0a7ff3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "grid-apps", - "version": "2.4.2.D", + "version": "2.4.3.D", "description": "grid.space 3d slice & modeling tools", "author": "Stewart Allen ", "license": "MIT", diff --git a/src/kiri.js b/src/kiri.js index 6862abcc..43c03371 100644 --- a/src/kiri.js +++ b/src/kiri.js @@ -6,7 +6,7 @@ if (!self.kiri) { self.kiri = { - beta: 2402, + beta: 2403, driver: {}, // driver modules loader: [] // module loading: array of functions }; diff --git a/src/kiri/stacks.js b/src/kiri/stacks.js index 1d60593b..e4a8a28e 100644 --- a/src/kiri/stacks.js +++ b/src/kiri/stacks.js @@ -40,7 +40,6 @@ // clear labels UC.setGroup(labels); labels.innerHTML = ''; - } function getStack(name) { @@ -65,6 +64,9 @@ }, clear: function() { view.remove(stack.view); + }, + button: function(label, action) { + UC.newRow([ UC.newButton(label, action) ]); } }; return stack; diff --git a/src/kiri/ui.js b/src/kiri/ui.js index a6cb4970..5840734e 100644 --- a/src/kiri/ui.js +++ b/src/kiri/ui.js @@ -8,10 +8,11 @@ let SELF = self, KIRI = self.kiri, + DOC = SELF.document, + inputAction = null, lastGroup = null, lastDiv = null, addTo = null, - inputAction = null, groups = {}, groupShow = {}, groupSticky = false, @@ -23,49 +24,52 @@ letMode = null, letExpert = false, letHoverPop = true, - DOC = SELF.document, - state = {}, - prefix = "tab", - NOMODE = "nomode", exitimer = undefined, - units = 1; + NOMODE = "nomode", + prefix = "tab", + state = {}, + units = 1, + lastBtn = null, + lastTxt = null, + lastPop = null, + savePop = null; SELF.$ = (SELF.$ || function (id) { return DOC.getElementById(id) } ); KIRI.ui = { prefix: function(pre) { prefix = pre; return kiri.ui }, inputAction: function(fn) { inputAction = fn; return kiri.ui }, - refresh: refresh, - setMode: setMode, - setExpert: setExpert, - setHoverPop: setHoverPop, - bound: bound, - toInt: toInt, - toFloat: toFloat, - hidePop: hidePop, - isPopped: isPopped, - newText: newTextArea, - newGCode: newGCode, - newLabel: newLabel, - newRange: newRange, - newInput: newInputField, - newButton: newButton, - newBoolean: newBooleanField, - newSelect: newSelect, - newTable: newTables, - newTableRow: newTableRow, - newRow: newRow, - newBlank: newBlank, - newGroup: newGroup, - setGroup: setGroup, - setUnits: setUnits, - addUnits: addUnits, - hidePoppers: hidePoppers, - confirm: confirm, - prompt: prompt, - alert: alert, checkpoint, - restore + restore, + refresh, + setMode, + setExpert, + setHoverPop, + hidePoppers, + bound, + toInt, + toFloat, + hidePop, + isPopped, + newBoolean, + newButton, + newBlank, + newGCode, + newGroup, + newInput, + newLabel, + newRange, + newRow, + newSelect, + newTable, + newTableRow, + newText, + setGroup, + addUnits, + setUnits, + confirm, + prompt, + alert }; function alert(message) { @@ -282,6 +286,13 @@ return row; } + function addCollapsableElement(parent) { + let row = newDiv(); + if (parent) parent.appendChild(row); + if (lastGroup) lastGroup.push(row); + return row; + } + function hidePoppers() { showGroup(undefined); } @@ -408,11 +419,6 @@ return div; } - let lastBtn = null; - let lastTxt = null; - let lastPop = null; - let savePop = null; - function hidePop() { if (lastPop) { lastPop.style.display = "none"; @@ -490,7 +496,7 @@ return txt; } - function newTextArea(label, options) { + function newText(label, options) { let opt = options || {}, inline = opt.row, row = inline ? lastDiv : newDiv(options), @@ -564,7 +570,7 @@ return txt; } - function newInputField(label, options) { + function newInput(label, options) { let opt = options || {}, row = newDiv(opt), hide = opt && opt.hide, @@ -714,7 +720,7 @@ return ip; } - function newBooleanField(label, action, options) { + function newBoolean(label, action, options) { let row = newDiv(options), ip = DOC.createElement('input'), hide = options && options.hide; @@ -757,6 +763,7 @@ return row; } + // unlike other elements, does not auto-add to a row function newButton(label, action, options) { let opt = options || {}, b = DOC.createElement('button'); @@ -786,27 +793,6 @@ return b; } - function newTableRow(arrayOfArrays, options) { - return newRow(newTables(arrayOfArrays), options); - } - - function newTables(arrayOfArrays) { - let array = []; - for (let i=0; i - All Rights Reserved", LICENSE: "See the license.md file included with the source distribution", - VERSION: "2.4.D2" + VERSION: "2.4.D3" }; if (typeof(module) === 'object') { diff --git a/src/mode/cam/client.js b/src/mode/cam/client.js index 33dd044a..85c0d1d7 100644 --- a/src/mode/cam/client.js +++ b/src/mode/cam/client.js @@ -13,10 +13,11 @@ isArrange, isCamMode, camStock, - API, SPACE, MODES, VIEWS, UI, UC; + API, SPACE, STACKS, MODES, VIEWS, UI, UC; CAM.init = function(kiri, api) { // console.log({kiri,api}) + STACKS = api.const.STACKS; SPACE = api.const.SPACE; MODES = api.const.MODES; VIEWS = api.const.VIEWS; @@ -64,12 +65,19 @@ "selection.scale", "selection.rotate" ], updateStock); + + api.event.on("preview.end", () => { + if (camStock) STACKS.getStack("bounds").button("animate", animate); + }); }; - function updateStock(args, event) { - const SPACE = API.const.SPACE; - const STACKS = API.const.STACKS; + function animate() { + API.view.set(VIEWS.ARRANGE); + API.widgets.opacity(0.75); + // console.log("animate", API.conf.get().stock); + } + function updateStock(args, event) { STACKS.remove('bounds'); if (isCamMode && isArrange) { STACKS.clear();