diff --git a/README.md b/README.md
index e8c91e5035a18c4d6cb941720e58c0d79cd7d96d..02cb8096f18950392fcc1107c846f8680f84594c 100644
--- a/README.md
+++ b/README.md
@@ -94,10 +94,20 @@ In the same vein, a lower level view has a key difference from the higher level
# Scratch
+ok, this is about to be rad, and useable (yay)
+ - zoom extents option returns
+ - top level: on 'z' key: extents
+ - ll request size change, fluid
+ - apres refresh, view unrolls link to edges
+
+take a minute, draw a machine
+ - direction-full links, kind of the whole point ...
+ - should just have to modify floop code
+
So, to start, I'll
- bounds limits proper
- bounds expansion by request?
- - get top level scale for drag moves
+ - get top level scale for drag moves
- want zoom-to-extents
- open internal
diff --git a/hunks/view.js b/hunks/view.js
index f726b23c3863f8090f5e5e4bbe177e64adbc5fd3..1f94a2b4d1ceffdddc0193b253c470f3185dbf64 100644
--- a/hunks/view.js
+++ b/hunks/view.js
@@ -109,14 +109,12 @@ function View() {
// append
$(this.dom).append(this.plane)
// more space
- this.requestResize(800, 500)
- this.requestResize(800, 500)
+ this.requestResize(1200, 800)
}
// we also have events that a level above us can fire...
-
this.onresize = () => {
- console.error('need to move things about, probably')
+ console.error('onresize: need to move things about, probably')
this.drawLinks()
}
@@ -128,7 +126,12 @@ function View() {
} else {
console.error('requestResize not yet implemented by parent')
}
+ }
+ this.requestSizeIncrease = (x,y) => {
+ //console.log('req', x, y)
+ let bounds = this.getCurrentBounds()
+ this.requestResize(bounds.w + x, bounds.h + y)
}
// here bc related to resizing, sizes
@@ -232,6 +235,12 @@ function View() {
ct.y += (ct.y - oy) * ds
this.tls = ct.s
+ // arduous, but
+ for(let def of defs){
+ if(def.type === 'view' && def.name !== 'tlview'){
+ def.hunk.tls = ct.s
+ }
+ }
if (ct.s < 1) {
dt.writeTransform(this.plane, ct)
@@ -631,7 +640,7 @@ function View() {
}
// we want to make sure that's in-bounds ...
let bounds = this.getCurrentBounds()
- console.log('bounds', bounds)
+ // console.log('bounds', bounds)
// console.log(`view ${this.name} adding ${def.name}, bounds`, this.getCurrentBounds())
if (!mt) {
// todo: put this somewhere on-screen ?
diff --git a/view/vdef.js b/view/vdef.js
index ff85b2dc40e6b85a39a063138684f79574b99022..442c7e8344ccf6ed64075d06e51dc1fa0e84df42 100644
--- a/view/vdef.js
+++ b/view/vdef.js
@@ -341,9 +341,10 @@ function HunkDefinition(spec, view, dt, debug) {
this.hunk.requestResize = (x, y) => {
// set manual and call update,
// doesn't matter which hunk this is in...
- console.log(`REQRESIZE hunk ${this.name} requesting size of ${x}, ${y}`)
- console.log('native', this.deg.native)
+ // console.log(`REQRESIZE hunk ${this.name} requesting size of ${x}, ${y}`)
+ // console.log('native', this.deg.native)
this.deg.native.requestResize(x, y)
+ view.tick()
}
// now we should be able to,
this.hunk.onload()
diff --git a/view/vfloater.js b/view/vfloater.js
index 1642d6c70902e851e331f921ea951241843b4ba5..afd6a311c611ea9fa003974e9de186d57e0e920b 100644
--- a/view/vfloater.js
+++ b/view/vfloater.js
@@ -347,6 +347,11 @@ function Floater(view, grouptype) {
this.x = x
this.y = y
}
+ // will return this ...
+ let desire = {
+ x: 0,
+ y: 0
+ }
// check bounds,
if(!view.isTopLevel){
// bummer to do so many times !
@@ -359,16 +364,23 @@ function Floater(view, grouptype) {
// x needs to contend with offset,
// this.bb.x1 probably -ve,
// this.bb.y1 probably -ve,
- this.x = Math.max(bounds.x1 - this.bb.x1, this.x) // lower bound
- this.x = Math.min(bounds.x2 - this.bb.x2, this.x) // upper bound
+ // want to track, but won't push things left or up,
+ this.x = Math.max(bounds.x1 - this.bb.x1, this.x) // lower bounds
this.y = Math.max(bounds.y1 - this.bb.y1, this.y)
- this.y = Math.min(bounds.y2 - this.bb.y2, this.y)
- // now we can check like
- if(this.reqx > this.x){
- // want more x
+
+ // want-right term,
+ let rbnd = bounds.x2 - this.bb.x2
+ if(this.x > rbnd){
+ desire.x = this.x - rbnd
+ this.x = rbnd
+ // wants to go right
}
- if(this.reqy > this.y){
- // want more y
+ // want-down term,
+ let lbnd = bounds.y2 - this.bb.y2
+ if(this.y > lbnd){
+ desire.y = this.y - lbnd
+ this.y = lbnd
+ // wants to go down
}
}
// do work
@@ -376,8 +388,8 @@ function Floater(view, grouptype) {
for (let item of this.bag) {
writePosition(item.de, this.x + item.offsetX, this.y + item.offsetY)
}
- // here ?
- view.drawLinks()
+ // aaaand tell em what we waaaaant
+ return desire
}
this.newFix = () => {
diff --git a/view/vfloop.js b/view/vfloop.js
index e033545c76e03f411b5fb2d279c6a835dbe05cee..cedd40e1e58305c703c938b0f51076d6078cae69 100644
--- a/view/vfloop.js
+++ b/view/vfloop.js
@@ -11,8 +11,23 @@ function Floop(View) {
let onTick = () => {
// bounds
// let's also draw some svgs into the plane, to debug ...
+ // ok ok, so ...
+ let pa = {
+ x: 0,
+ y: 0
+ }
for (let nd of nodes) {
- nd.moveTo()
+ // moveTo() calls drawLinks
+ let p = nd.moveTo()
+ pa.x += p.x
+ pa.y += p.y
+ }
+ if(pa.x > 2 || pa.y > 2){
+ let incx = 0
+ let incy = 0
+ if(pa.x > 2) incx = 1
+ if(pa.y > 2) incy = 1
+ view.requestSizeIncrease(incx, incy)
}
view.drawLinks()
}