diff --git a/README.md b/README.md index dab9a13cae920d6777575e3be2519ecb0e4f9f3f..3c48e336162f2ed36338490c0efd8e4c96eb1ffe 100644 --- a/README.md +++ b/README.md @@ -212,6 +212,7 @@ ok, this is about to be rad, and useable (yay) - event drag - resize handlers don't use .tls to scale moves - views + - merge ponyoprog (esp. case where nautilus is still chillen) - git 2 ponyo diff --git a/view/vdef.js b/view/vdef.js index 355c64c86b55ee634a8097ab2dacabdb332f9755..64b159ca881fbb2e42b4f2938f131497474ad63e 100644 --- a/view/vdef.js +++ b/view/vdef.js @@ -517,22 +517,13 @@ function OutputDefinition(opspec, ind, def, view, dt, debug) { this.hasFloater = false // ondrag, attached later let evtDrag = (evt) => { - // jake wants dead reckoning evt.preventDefault() evt.stopPropagation() - //let cp = this.readTransform(floater) - let pt = dt.readTransform(view.plane) - let thet = {} - // put it there ... - thet.s = 1 - //console.log(pt.s) - // ... - let fltheight = this.floater.clientHeight - let fltwidth = this.floater.clientWidth - //console.log('mouse', evt.clientY, 'pt', pt.y, 'height', fltheight) - //console.log(fltheight, fltwidth) - thet.x = (evt.clientX - pt.x) / pt.s - ((fltwidth + 5) / pt.s) - thet.y = (evt.clientY - pt.y) / pt.s - (fltheight + (pt.s - 1) * (-5)) / pt.s // - ((fltheight * pt.s) / 2) / pt.s + let pt = dt.readTransform(view.tlv.plane) + let thet = dt.readTransform(this.floater) + // ... set delta + thet.x += evt.movementX / pt.s + thet.y += evt.movementY / pt.s dt.writeTransform(this.floater, thet) view.drawLinks() } @@ -566,15 +557,18 @@ function OutputDefinition(opspec, ind, def, view, dt, debug) { this.floater = $('<div>').attr('id', 'floater').append(this.type).get(0) this.hasFloater = true this.floater.style.zIndex = '1' - // the plane position - let pt = dt.readTransform(view.plane) + // set initial position by the outputs' position, + let dparent = $(this.de).parent().get(0) + let opp = dt.readTransform(dparent) + // top-level plane ... + let pt = dt.readTransform(view.tlv.plane) // plonk: have to do this now or else clientHeight / width are 0 view.plane.appendChild(this.floater) // init out floater position, and put it in the dom dt.writeTransform(this.floater, { s: 1, - x: (evt.clientX - pt.x) / pt.s - ((this.floater.clientWidth + 5) / pt.s), - y: (evt.clientY - pt.y) / pt.s - (this.floater.clientHeight + (pt.s - 1) * (-5)) / pt.s // - ((fltheight * pt.s) / 2) / pt.s + x: opp.x - ((this.floater.clientWidth + 5)), + y: opp.y + this.floater.clientHeight * (this.ind + 0.5) // - ((fltheight * pt.s) / 2) / pt.s }) // handlers to drag, and remove document.addEventListener('mousemove', evtDrag)