From 864db0913a87ae79336d5b209df2b42a8e861afd Mon Sep 17 00:00:00 2001 From: Jake <jake.read@cba.mit.edu> Date: Sat, 20 Apr 2019 22:24:55 -0400 Subject: [PATCH] message box --- README.md | 11 ++++++++++- hunks/comm/websocketclient.js | 6 +++--- hunks/link.js | 2 ++ hunks/view.js | 21 ++++++++++++++------- style.css | 2 +- 5 files changed, 30 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 857af22..a9ccb0a 100644 --- a/README.md +++ b/README.md @@ -130,7 +130,16 @@ There's some UI leftovers in the view. - want to kick around on spreading things out properly using force layout - can't add links, did this actually work before ? drag correct zoom factor, and cancel other moves -- towards using state-load-at-program-load to set retrycount to 0 +- ok , the two bigbois right now are + - the link is a hot mess, unwritten, you have to do this to start serialization + - the view is still itchy + - force layout ... zoom to extents always (or if checked state?) + - force layout ... no overlapping + - force layout ... use links as forces + - force layout ... push relationships between constituents + - drawing links is yikes, + - push to the back, address multiple-link issue when you have multiples to show + - connecting things ? wtf ? - loading is messy, - load in state objects before init (rolling through much old code) diff --git a/hunks/comm/websocketclient.js b/hunks/comm/websocketclient.js index ba9e87c..790c955 100644 --- a/hunks/comm/websocketclient.js +++ b/hunks/comm/websocketclient.js @@ -30,7 +30,7 @@ function WebSocketClient() { this.outbuffer = new Array() this.init = () => { - startWs() + setCheck(100) } let startWs = () => { @@ -82,8 +82,8 @@ function WebSocketClient() { if (retrycount < 1) { // give up this.state.status.set('not connected') - this.state.retrycount.set(retrycount) - checking = false + this.state.retrycount.set(0) + checking = false } else { this.state.retrycount.set(retrycount) checking = false diff --git a/hunks/link.js b/hunks/link.js index 79994e5..e538c05 100644 --- a/hunks/link.js +++ b/hunks/link.js @@ -28,6 +28,8 @@ function Link() { let inports = [this.inputs.zero, this.inputs.zero, this.inputs.one] let outports = [this.outputs.zero, this.outputs.zero] + // ok, on init look at state list + /* // these are *special link inputs* keeping track of downstream status diff --git a/hunks/view.js b/hunks/view.js index 7a61b40..d87c114 100644 --- a/hunks/view.js +++ b/hunks/view.js @@ -96,15 +96,18 @@ function View() { let height = 0; $(this.msgbox).children().each(function(child){ // jquery.each() syntax is a bit odd / different than elsewhere, sorry for inconsistency - height += this.clientHeight + height += this.clientHeight + 5 }) return height } // if too tall, remove - if(heightcheck() > $(this.msgbox).clientHeight){ + let ch = this.msgbox.clientHeight + if(heightcheck() > ch){ + console.log('rm 1', heightcheck(), ch) $(this.msgbox).children().get(0).remove() // two at most, sloppy but fast - if(heightcheck() > $(this.msgbox).clientHeight){ + if(heightcheck() > ch){ + console.log('rm 2', heightcheck(), ch) $(this.msgbox).children().get(0).remove() } } @@ -176,7 +179,7 @@ function View() { let menu = $('<div>').addClass('contextmenu') .append('<ul> hello -> </ul>').get(0) let ct = readTransform(this.plane) - console.log('write to ', ct) + ///console.log('write to ', ct) writeTransform(menu, { s: 1, x: evt.layerX - ct.x * ct.s, @@ -235,7 +238,7 @@ function View() { // init and/or update if (!flsimrun && blocks.length > 1) { // Case for starting sim - console.log('starting force sim') + writeToMessageBox('starting force sim') flsimrun = true // start with two nodes let positions = this.getAllHunkPositions() @@ -259,7 +262,7 @@ function View() { // donot } else { // case for adding / rming from sim - this.log('UPD8 Force Sim') + writeToMessageBox('UPD8 Force Sim') let positions = this.getAllHunkPositions() if (positions.length > flnodes.length) { let last = positions.length - 1 @@ -274,7 +277,7 @@ function View() { flnodes.push(newNode) // console.log('SIM adds now this', newNode.x, newNode.y) } else { - console.log("SIM DELETE CASE NOT WRITTEN") + writeToMessageBox("SIM DELETE CASE NOT WRITTEN") } flsim.nodes(flnodes) flsim.alpha(1) @@ -496,6 +499,7 @@ function View() { } } drawLinks() + updateForceLoop() } let putLink = (outId, outName, inId, inName) => { @@ -503,8 +507,10 @@ function View() { let outp = $(this.plane).children('.block').children('.outputs').children('#' + outId + '_output_' + outName).get(0) outp.connectedTo.push('#' + inId + '_input_' + inName) drawLinks() + updateForceLoop() } catch (err) { console.log('ERR at putlink', err) + writeToMessageBox('ERR at putlink' + err) return false } return true @@ -517,6 +523,7 @@ function View() { drawLinks() } catch (err) { console.log('ERR at rmlink', err) + writeToMessageBox('ERR at rmlink' + err) return true } return false diff --git a/style.css b/style.css index 6a367ea..2465b87 100644 --- a/style.css +++ b/style.css @@ -56,7 +56,7 @@ body { .msgbox { width: 300px; - height: 500px; + height: 90%; padding: 10px; margin: 10px; float: right; -- GitLab