diff --git a/hunks/output/linechart.js b/hunks/data/linechart.js similarity index 100% rename from hunks/output/linechart.js rename to hunks/data/linechart.js diff --git a/hunks/debug/logger.js b/hunks/data/logger.js similarity index 100% rename from hunks/debug/logger.js rename to hunks/data/logger.js diff --git a/hunks/primitive/positivevalueof.js b/hunks/math/positivevalueof.js similarity index 100% rename from hunks/primitive/positivevalueof.js rename to hunks/math/positivevalueof.js diff --git a/style.css b/style.css index cce2b8becde7423470b79d74310e14ee977736f7..2683da9e87e56f06136a830c1ed9215df4973190 100644 --- a/style.css +++ b/style.css @@ -307,6 +307,10 @@ li { padding: 7px 5px 6px 5px; } +li.highlighted{ + background-color: #969696; +} + li:hover{ background-color: #969696; cursor: pointer; diff --git a/view/vcontextmenu.js b/view/vcontextmenu.js index e1350d6db4b2269ebe2db274392d773be0b48ade..23266997d810f64c95b9e285f22403353bfe286e 100644 --- a/view/vcontextmenu.js +++ b/view/vcontextmenu.js @@ -29,7 +29,7 @@ function cfContextMenu(evt, view, dt) { let setupForSave = (se, obj) => { $(se.target).closest('li').text('') - let tinput = $('<input>').attr('type', 'text').attr('size', 24).attr('value', 'systemName').get(0) + let tinput = $('<input>').attr('type', 'text').attr('size', 24).attr('value', 'name').get(0) $(se.target).closest('li').append(tinput) // etc $(tinput).focus() $(tinput).select() @@ -79,9 +79,45 @@ function cfContextMenu(evt, view, dt) { $(view.dom).append(menu) // hmmm - changeContextTitle('you can... ') + changeContextTitle('do: ') // on of the options will ... + // add the text window, select it ... + // also want: keyboard and enter ... track which is selected, then ? + let tinput = $('<input>').attr('type', 'text').attr('size', 28).attr('value', '').get(0) + $(view.dom).find('.contextmenu').children('.contextTitle').get(0).append(tinput) + $(tinput).focus() + $(tinput).select() + tinput.addEventListener('keyup', (evt) => { + if(evt.keyCode == 13){ + // enter case + let pick = $(view.dom).find('.contextmenu').children('.highlighted').get(0) + pick.click() + } else { + // key character ? + let filt = tinput.value.toUpperCase() + let arr = $(view.dom).find('.contextmenu').children('li').toArray() + let sel = false + // separate items by space, search for either, + // reorder by search quality + for(let item of arr){ + if($(item).text().toUpperCase().indexOf(filt) > -1){ + item.style.display = "" + // mark as selected, then this is our enter-docu + if(!sel){ + $(item).addClass('highlighted') + sel = true + } else { + $(item).removeClass('highlighted') + } + } else { + item.style.display = "none" + $(item).removeClass('highlighted') + } + } + } + }) + /* --------------------------- ---------------------------- */ /* ---------------- LOCAL OPTIONS, for SCOPE ----------------- */ /* --------------------------- ---------------------------- */ diff --git a/view/vtoplevel.js b/view/vtoplevel.js index 7390069bf0c217c1a2163823345a4ff21f22cf94..d1764d28e4e15dd86d49d0e0f1900fcb79090b28 100644 --- a/view/vtoplevel.js +++ b/view/vtoplevel.js @@ -178,7 +178,12 @@ function makeTopLevel(view) { // key listeners (are global, bc ...) KEYCODES document.addEventListener('keydown', (evt) => { - if (evt.key === 'k' && evt.ctrlKey) { + if (evt.key === 'm') { + // want this, but blocked by contextmenu wanting mouse location (from evt target) + console.error('soon') + // from bottom of this page: + // cfContextMenu(evt, view, dt) + } else if (evt.key === 'k' && evt.ctrlKey) { evt.preventDefault() evt.stopPropagation() view.kick() @@ -235,8 +240,8 @@ function makeTopLevel(view) { let vt = dt.readTransform(view.plane) console.log('vt', vt) $(menu).remove() - let xp = (mt.x - vt.x) * (1/vt.s) - let yp = (mt.y - vt.y) * (1/vt.s) + let xp = (mt.x - vt.x) * (1 / vt.s) + let yp = (mt.y - vt.y) * (1 / vt.s) return { x: xp, y: yp @@ -267,7 +272,7 @@ function makeTopLevel(view) { // this is the heirarchy dive let thru = next.parent.reciprocalLink if (thru) { - if(debug) console.log(`TRACE: next link`, thru) + if (debug) console.log(`TRACE: next link`, thru) // a mirror, try { let otp = thru.outputs[next.ind] @@ -327,7 +332,7 @@ function makeTopLevel(view) { // ok, first off, are these things in the same view? can I find a view from an outputs? let opv = output.parent.parentView let ipv = input.parent.parentView - if(debug) console.log(`output parentview is ${opv.name} and input parent view is ${ipv.name}`) + if (debug) console.log(`output parentview is ${opv.name} and input parent view is ${ipv.name}`) if (opv === ipv) { // we r on par if (debug) console.log(`BR: inputs are the same to ${view.name}`) @@ -341,8 +346,8 @@ function makeTopLevel(view) { // we should run a .go before this... view.globalOrganize() // now, - if(debug) console.log(`BR: GO completes, now build for:`) - if(debug) console.log(`BR: from ${output.name} in ${output.parent.name} to ${input.name} in ${input.parent.name}`) + if (debug) console.log(`BR: GO completes, now build for:`) + if (debug) console.log(`BR: from ${output.name} in ${output.parent.name} to ${input.name} in ${input.parent.name}`) let finroute = [] // we are the top level ... but we should hunt by link, var recurse = (view, entrance, trace) => { @@ -376,8 +381,8 @@ function makeTopLevel(view) { } recurse(opv, null, []) // ... - if(debug) console.log(`BR: recursion ran to completion, route is len ${finroute.length}`) - if(debug) console.log(`BR: the route:`, finroute) + if (debug) console.log(`BR: recursion ran to completion, route is len ${finroute.length}`) + if (debug) console.log(`BR: the route:`, finroute) if (finroute.length < 1) { if (debug) console.log(`BR: no route returned...`) console.error("no route to build...") @@ -546,35 +551,35 @@ function makeTopLevel(view) { } // end globalOrganize -view.zebraHeirarchy = (debug) => { - // we can go about this just by the way the visual relationship is organized, - let traverse = (view, lvl) => { - if(lvl > 6){ - console.warn('zebraHeirarchy traverses 6+ levels, you sure about this? exiting to avoid infinite loop') - return - } - lvl ++ - if(debug) console.log(`ZH traverses to ${view.name} at lvl${lvl}`) - for(let df of view.defs){ - if(df.type === 'link'){ - if(df.floatGroupType === 'wrappedon'){ - // this link 'contains' a view, - if (lvl % 2 === 0) { - if(debug) console.log(`ZH sets ${view.name} to f0`) - $(df.reciprocalView.dom).css('background-color', '#f0f0f0') - //$(df.deg.native).children('.view').css('background-color', '#f0f0f0') - } else { - if(debug) console.log(`ZH sets ${view.name} to e0`) - $(df.reciprocalView.dom).css('background-color', '#e0e0e0') - //$(df.deg.native).children('.view').css('background-color', '#e0e0e0') + view.zebraHeirarchy = (debug) => { + // we can go about this just by the way the visual relationship is organized, + let traverse = (view, lvl) => { + if (lvl > 6) { + console.warn('zebraHeirarchy traverses 6+ levels, you sure about this? exiting to avoid infinite loop') + return + } + lvl++ + if (debug) console.log(`ZH traverses to ${view.name} at lvl${lvl}`) + for (let df of view.defs) { + if (df.type === 'link') { + if (df.floatGroupType === 'wrappedon') { + // this link 'contains' a view, + if (lvl % 2 === 0) { + if (debug) console.log(`ZH sets ${view.name} to f0`) + $(df.reciprocalView.dom).css('background-color', '#f0f0f0') + //$(df.deg.native).children('.view').css('background-color', '#f0f0f0') + } else { + if (debug) console.log(`ZH sets ${view.name} to e0`) + $(df.reciprocalView.dom).css('background-color', '#e0e0e0') + //$(df.deg.native).children('.view').css('background-color', '#e0e0e0') + } + traverse(df.reciprocalView, lvl) } - traverse(df.reciprocalView, lvl) } } } + traverse(view, 0) } - traverse(view, 0) -} view.expandLink = (linkDef) => { return new Promise((resolve, reject) => {