From: Matteo Nastasi (mop) Date: Wed, 7 Dec 2011 08:20:31 +0000 (+0100) Subject: dir tree refactored X-Git-Url: http://mop.ddnsfree.com/gitweb/?p=xynt.git;a=commitdiff_plain;h=9f0cbf62feaea515635cfc85bddd5292b2170440 dir tree refactored --- diff --git a/commons.js b/commons.js deleted file mode 100644 index cb8076f..0000000 --- a/commons.js +++ /dev/null @@ -1,99 +0,0 @@ -function $(id) { return document.getElementById(id); } - -function getStyle(x,IEstyleProp, MozStyleProp) -{ - if (x.currentStyle) { - var y = x.currentStyle[IEstyleProp]; - } else if (window.getComputedStyle) { - var y = document.defaultView.getComputedStyle(x,null).getPropertyValue(MozStyleProp); - } - return y; -} - - /* replacement of setInterval on IE */ -(function(){ - /*if not IE, do nothing*/ - if(!document.uniqueID){return;}; - - /*Copy the default setInterval behavior*/ - var nativeSetInterval = window.setInterval; - window.setInterval = function(fn,ms) { - var param = []; - if(arguments.length <= 2) { - return nativeSetInterval(fn,ms); - } - else { - for(var i=2;i - - - - - - - - - - diff --git a/test-dd.html b/test-dd.html deleted file mode 100644 index 8fdfaf4..0000000 --- a/test-dd.html +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - - -
- -
- -
- - diff --git a/test-div-coord.html b/test-div-coord.html deleted file mode 100644 index f9ada6b..0000000 --- a/test-div-coord.html +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - - - - - - -
-aa1
aa2
aa3
aa4
aa5
aa6
aa7
aa8
aa9
aaA
aaB
aaC
aaD
aaE
aaF
aa0
-aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
-bb1
bb2
bb3
bb4
bb5
bb6
bb7
bb8
bb9
bbA
bbB
bbC
bbD
bbE
bbF
bb0
-
- -
- -
-aa1
aa2
aa3
aa4
aa5
aa6
aa7
aa8
aa9
aaA
aaB
aaC
aaD
aaE
aaF
aa0
-aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
-bb1
bb2
bb3
bb4
bb5
bb6
bb7
bb8
bb9
bbA
bbB
bbC
bbD
bbE
bbF
bb0
-
- - - diff --git a/web/img/arrow_do.png b/web/img/arrow_do.png new file mode 100644 index 0000000..7815d6f Binary files /dev/null and b/web/img/arrow_do.png differ diff --git a/web/img/arrow_le.png b/web/img/arrow_le.png new file mode 100644 index 0000000..c910177 Binary files /dev/null and b/web/img/arrow_le.png differ diff --git a/web/img/arrow_ri.png b/web/img/arrow_ri.png new file mode 100644 index 0000000..9506d7a Binary files /dev/null and b/web/img/arrow_ri.png differ diff --git a/web/img/arrow_up.png b/web/img/arrow_up.png new file mode 100644 index 0000000..a3bb571 Binary files /dev/null and b/web/img/arrow_up.png differ diff --git a/web/test-base.html b/web/test-base.html new file mode 100644 index 0000000..5fb1830 --- /dev/null +++ b/web/test-base.html @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/web/test-dd.html b/web/test-dd.html new file mode 100644 index 0000000..23ccc3c --- /dev/null +++ b/web/test-dd.html @@ -0,0 +1,18 @@ + + + + + + + + + + + +
+ +
+ +
+ + diff --git a/web/test-div-coord.html b/web/test-div-coord.html new file mode 100644 index 0000000..6217fc9 --- /dev/null +++ b/web/test-div-coord.html @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + +
+aa1
aa2
aa3
aa4
aa5
aa6
aa7
aa8
aa9
aaA
aaB
aaC
aaD
aaE
aaF
aa0
+aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+bb1
bb2
bb3
bb4
bb5
bb6
bb7
bb8
bb9
bbA
bbB
bbC
bbD
bbE
bbF
bb0
+
+ +
+ +
+aa1
aa2
aa3
aa4
aa5
aa6
aa7
aa8
aa9
aaA
aaB
aaC
aaD
aaE
aaF
aa0
+aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+bb1
bb2
bb3
bb4
bb5
bb6
bb7
bb8
bb9
bbA
bbB
bbC
bbD
bbE
bbF
bb0
+
+ + + diff --git a/web/xynt-base-test.js b/web/xynt-base-test.js new file mode 100644 index 0000000..2b45c79 --- /dev/null +++ b/web/xynt-base-test.js @@ -0,0 +1,139 @@ +function A(a, b) { + this.a_dyn = "A DYN"; + this.a = a; + this.b = b; +} + +A.prototype = { + a_stat: "A STAT", + + a_func: function () { + console.log("a_func run"); + }, + aa_func: function () { + console.log("aa_func run in A class"); + } +} + +function B(a, b) { + this.b_dyn = "B DYN"; + A.call(this, a, b); +} + +B.prototype = { + b_stat: "B STAT", + + a_func: function () { + console.log("a_func run from B"); + console.log("and now try to call the super method"); + this.callSuper("a_func"); + }, + + b_func: function () { + console.log("b_func run"); + } +} +function C() { + this.c_dyn = "C DYN"; +} + +C.prototype = { + c_stat: "C STAT", + + aa_func: function () { + console.log("aa_func run in C class"); + }, + + c_func: function () { + console.log("c_func run"); + } +} + +Extends(B, A); + +function print_dynstat(inst, name) +{ + for (i = 0 ; i < inst.length ; i++) { + console.log(name[i]+".a_dyn: "+inst[i].a_dyn); + console.log(name[i]+".a_stat: "+inst[i].a_stat); + if (name[i][0] == 'b') { + console.log(name[i]+".b_dyn: "+inst[i].b_dyn); + console.log(name[i]+".b_stat: "+inst[i].b_stat); + } + if (name[i][0] == 'c') { + console.log(name[i]+".c_dyn: "+inst[i].c_dyn); + console.log(name[i]+".c_stat: "+inst[i].c_stat); + } + } +} + +window.onload = function () { + console.log("Window.onload: begin"); + show_class(A); + show_class(B); + show_class(C); + + a1 = new A(1,2); + a2 = new A(3,4); + b1 = new B(5,6); + c1 = new C(); + + arr_inst = [ a1 , a2 , b1 , c1 ]; + arr_name = [ "a1", "a2", "b1", "c1" ]; + + print_dynstat(arr_inst, arr_name); + + console.log("---"); + console.log("ACTION: a1.a_stat = \"CHANGED\";"); + a1.a_stat = "CHANGED"; + + print_dynstat(arr_inst, arr_name); + + console.log("---"); + console.log("ACTION: A.prototype.a_stat = \"PROTO CHANGED\""); + A.prototype.a_stat = "PROTO CHANGED"; + + print_dynstat(arr_inst, arr_name); + + console.log("---"); + console.log("ACTION: ExtendsInst(c1, A, [1, 33])"); + + var ext = ExtendsInst(c1, A, [1, 33]); + console.log("ExtInst: "+(ext == true ? "TRUE" : "FALSE")); +// } function azaz() { + print_dynstat(arr_inst, arr_name); + + console.log("---"); + console.log("ACTION: B.prototype.a_stat = \"PROTO CHANGED\""); + B.prototype.a_stat = "PROTO CHANGED"; + + print_dynstat(arr_inst, arr_name); + + console.log("---"); + console.log("ACTION: A.prototype.a_stat = \"PROTO CHANGED 2\""); + console.log("ACTION: C.prototype.c_stat = \"PROTO CHANGED 2\""); + A.prototype.a_stat = "PROTO CHANGED 2"; + C.prototype.c_stat = "PROTO CHANGED 2"; + + print_dynstat(arr_inst, arr_name); + + console.log("---"); + console.log("=== INSTANCE b1 ==="); + show_inst(b1); + console.log("=== INSTANCE b1.a_func() ==="); + b1.a_func(); + console.log("=== INSTANCE b1.b_func() ==="); + b1.b_func(); + + console.log("---"); + console.log("=== INSTANCE c1 ==="); + show_inst(c1); + console.log("=== INSTANCE c1.a_func() ==="); + c1.a_func(); + console.log("=== INSTANCE c1.aa_func() ==="); + c1.aa_func(); + console.log("=== INSTANCE c1.callSuper aa_func() ==="); + c1.callSuper("aa_func"); + console.log("=== INSTANCE c1.c_func() ==="); + c1.c_func(); +} \ No newline at end of file diff --git a/web/xynt-dd-test.js b/web/xynt-dd-test.js new file mode 100644 index 0000000..3cc8e54 --- /dev/null +++ b/web/xynt-dd-test.js @@ -0,0 +1,8 @@ +function dropt1() +{ + ; //alert("t1"); +} +window.onload = function() { + console.log("HT"+$('t1')); + xynt_dd.call($('t1'), dropt1, -1600, 1600, 10,10); +} \ No newline at end of file diff --git a/web/xynt-div-coord-test.js b/web/xynt-div-coord-test.js new file mode 100644 index 0000000..f678f3f --- /dev/null +++ b/web/xynt-div-coord-test.js @@ -0,0 +1,95 @@ + +function dimension() +{ + //var w = getStyle(window.document.body, "width", "width"); + //var h = getStyle(window.document.body, "height", "height"); + var w = window.innerWidth; + var h = window.innerHeight; + + console.log("W: "+w+" H: "+h); + + $('board-drag').style.left = (parseInt(w) / 2 - 2)+"px"; + $('board-drag').style.top = "0px"; + /*$('board-drag').style.width = (10)+"px"; */ + $('board-drag').style.height = (parseInt(h) - 2)+"px"; + + $('board').xynt_divcoo_hidescroll = 0; + $('board').style.top = "0px"; + $('board').style.left = "0px"; + // $('board').style.width = (parseInt(w) / 2 - 2)+"px"; + $('board').style.height = (parseInt(h) - 2)+"px"; + + $('board').style.width = parseInt($('board-drag').style.left)+$('board').xynt_divcoo_hidescroll+"px"; + if (parseInt($('board').style.width) > $('board').clientWidth) { + // alert("di qui"); + $('board').xynt_divcoo_hidescroll = parseInt($('board').style.width) - $('board').clientWidth; + $('board').style.width = parseInt($('board-drag').style.left)+$('board').xynt_divcoo_hidescroll+"px"; + // $('board').style.width = (parseInt($('board').style.width) + $('board').xynt_divcoo_hidescroll)+"px"; + } + + // $('board2').style.left = (parseInt(w) / 2 - 1 + parseInt($('board-drag').style.width))+"px"; + $('board2').style.left = parseInt($('board-drag').style.left)+parseInt($('board-drag').style.width)+1+"px"; + $('board2').style.top = "0px"; + $('board2').style.width = (w - (parseInt($('board-drag').style.left)+parseInt($('board-drag').style.width)+4))+"px"; + // $('board2').style.width = (parseInt(w) / 2 - 2 - 10)+"px"; + $('board2').style.height = (parseInt(h) - 2)+"px"; + + + + var h1 = $('board2').clientHeight; + var h2 = $('board').clientHeight; + + if (h1 > h2) { + $('board2').style.height = h2+"px"; + } + else if (h2 > h1) { + $('board').style.height = h1+"px"; + } + + console.log($('board2').scrollTop); + $('board').scrollTop = $('board2').scrollTop; +} + + +function resize(event, obj) +{ + if (event == 'drag') { + var w = window.innerWidth; + + $('board').style.width = parseInt($('board-drag').style.left)-1+$('board').xynt_divcoo_hidescroll+"px"; + $('board2').style.left = parseInt($('board-drag').style.left)+parseInt($('board-drag').style.width)+1+"px"; + $('board2').style.width = (w - (parseInt($('board-drag').style.left)+parseInt($('board-drag').style.width)+4))+"px"; + console.log("conn_update: "+event); + } +} + + +function scroll() +{ + // console.log("scroll"); + // $('board').style.top = -parseInt($('board2').scrollTop)+"px"; + $('board').scrollTop = $('board2').scrollTop; +} + +function scroll2() +{ + // console.log("scroll2:"); + $('board2').scrollTop = $('board').scrollTop; +} + +function dropr1() +{ + ; //alert("t1"); +} + +window.onload = function () { + dimension(); + $('board').xynt_conn_update = resize; + var ret = ExtendsInst($('board-drag'), xynt_dd, [ dropr1, -1600, 1600, 0,0 ]); + console.log("RET: "+ret); + console.log("xynt_conn_ect-v"); + console.log($('board-drag').xynt_conn_ect); + $('board-drag').xynt_conn_ect($('board')); + // console.log($('board-drag')); + return; +} diff --git a/web/xynt/xynt-base.js b/web/xynt/xynt-base.js new file mode 100644 index 0000000..de7cd25 --- /dev/null +++ b/web/xynt/xynt-base.js @@ -0,0 +1,179 @@ + +function Extends(sub) +{ + var proto; + thinF = function(){}; + inh = new thinF(); + inh.xynt_sup = []; + inh.xynt_sup_cl = []; + + console.log("EXT START"); + + var multi = function(sub, super, is_last) + { + var proto = super.prototype; + + for (var f in proto) { + if (f == "xynt_sup" || f == "xynt_sup_cl") + continue; + + console.log("LOOP: "+f); + if( f != "constructor" && typeof(proto[f]) == "function" && !is_last){ + console.log("M_FU: "+proto[f]+" F: "+f); + // sub[f] = proto[f]; + sub[f] = function() { + // console.log("INFU PR: " + proto[f] + " FUNC: "+f+" THIS: " + this); + console.log("SIMPLE LOG"); + return proto[f].apply(this,arguments); + } + } + else { + console.log("M_PR: "+proto.name+" A: "+f+" FUN: "+proto[f]); + sub[f] = proto[f]; + } + } + } + + for( var i=1; i < arguments.length ; i++){ + multi(inh, arguments[i], false); + inh.xynt_sup.push(arguments[i].prototype); + inh.xynt_sup_cl.push(arguments[i]); + } + + multi(inh, sub, true); + + + inh.callSuper = function(fnc){ + var len = this.xynt_sup_cl.length; + for ( var i=0 ; i/g,'>'). + replace(/\n"); + }, + + log: function(s) { + if (!this.enable) { + return; + } + if (typeof(s) == "string" || typeof(s) == "function") { + this.div.innerHTML += this.escapeHTML(s); + } + else { + ind = 4; + this.dump_obj(s,ind); + } + this.div.innerHTML += "
\n"; + this.win.document.body.scrollTop = 10000000; + }, + + dump_obj: function(s, ind) { + var sind = ""; + + sind = ""; + for (i = 0 ; i < ind ; i++) { + sind += " "; + } + sind += ""; + for (i in s) { + if (typeof(s[i]) == 'string' || typeof(s[i]) == "function") { + var ret = ""; + var arr = this.escapeHTML(s[i]).split("\n"); + for (el in arr) { + ret += sind + arr[el] + "\n"; + } + // this.div.innerHTML += "xx["+this.escapeHTML(i) + "] : [" + ret + "]

\n"; + this.div.innerHTML += this.escapeHTML(i)+"
\n"; + this.div.innerHTML += ret + "

\n"; + } + else { + this.dump_obj(s[i], ind+4); + } + } + // this.div.innerHTML += "post-loop
"; + }, + + logger: function(s) { + if (!this.enable) { + return; + } + this.div.innerHTML += s + "
"; + this.win.document.body.scrollTop = 10000000; + }, + + close: function() { + if (this.enable) { + this.win.close(); + } + } +} + +/* + * create and destroy + */ +var is_xynt_console = false; +var console_enable = true; + +if(typeof(console) == "undefined") { + var console; + + console = new xynt_console(console_enable); + + is_xynt_console = true; +} +else { + // conzole.logger = console.log; + // conzole.log = function () { return 0; } +} + +function deconsole() { + if (is_xynt_console) { + console.close(); + } +} + +function log_walk(curtag) +{ + var ind = 0; + var ancestor = curtag; + do { + console.log(spcs("_", "+", ind)+" ["+curtag.tagName+"] nodeType: "+curtag.nodeType+" inner: ["+curtag.innerHTML+"]"); + if (curtag.firstChild != null && curtag.tagName != "TD") { + ind += 2; + curtag = curtag.firstChild; + } + else if (curtag.nextSibling != null) { + curtag = curtag.nextSibling; + } + else if (curtag.parentNode.nextSibling != null) { + ind -= 2; + curtag = curtag.parentNode.nextSibling; + } + else + curtag = null; + } while (curtag != null && curtag != ancestor); +} + + diff --git a/web/xynt/xynt-dd.js b/web/xynt/xynt-dd.js new file mode 100644 index 0000000..f9eec36 --- /dev/null +++ b/web/xynt/xynt-dd.js @@ -0,0 +1,202 @@ +/* + * brisk - dom-drag.js + * + * Copyright (C) 2006-2011 Matteo Nastasi + * mailto: nastasi@alternativeoutput.it + * matteo.nastasi@milug.org + * web: http://www.alternativeoutput.it + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABLILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. You should have received a + * copy of the GNU General Public License along with this program; if + * not, write to the Free Software Foundation, Inc, 59 Temple Place - + * Suite 330, Boston, MA 02111-1307, USA. + * + */ + +/************************************************** + * dom-drag.js + * 09.25.2001 + * www.youngpup.net + ************************************************** + * 10.28.2001 - fixed minor bug where events + * sometimes fired off the handle, not the root. + **************************************************/ + +function xynt_dd(mouseup_cb, minX, maxX, minY, maxY, bSwapHorzRef, bSwapVertRef, fXMapper, fYMapper) +{ + xynt_connect.call(this); + + this.onmousedown = xynt_dd.prototype.start; + this.mouseup_cb = mouseup_cb; + + this.hmode = bSwapHorzRef ? false : true ; + this.vmode = bSwapVertRef ? false : true ; + + this.root = (this.xynt_dom_el && this.xynt_dom_el != null) ? this.xynt_dom_el : this ; + + if (this.hmode && isNaN(parseInt(this.root.style.left))) { + var res = parseInt(getStyle(o, "left", "left")); + if (isNaN(res)) { + this.root.style.left = "0px"; + } + else { + this.root.style.left = res; + } + } + if (this.vmode && isNaN(parseInt(this.root.style.top ))) { + var res = parseInt(getStyle(o, "top", "top")); + if (isNaN(res)) { + this.root.style.top = "0px"; + } + else { + this.root.style.top = res; + } + } + if (!this.hmode && isNaN(parseInt(this.root.style.right ))) this.root.style.right = "0px"; + if (!this.vmode && isNaN(parseInt(this.root.style.bottom))) this.root.style.bottom = "0px"; + + this.minX = typeof minX != 'undefined' ? minX : null; + this.minY = typeof minY != 'undefined' ? minY : null; + this.maxX = typeof maxX != 'undefined' ? maxX : null; + this.maxY = typeof maxY != 'undefined' ? maxY : null; + + this.xMapper = fXMapper ? fXMapper : null; + this.yMapper = fYMapper ? fYMapper : null; + + this.root.onDragStart = new Function(); + this.root.onDragEnd = new Function(); + this.root.onDrag = new Function(); +} + +xynt_dd.prototype = { + + obj : null, + + start : function(e) + { + var o = xynt_dd.obj = this; + e = xynt_dd.prototype.fixE(e); + + if (!e) + var e = window.event + // handle event + e.cancelBubble = true; + if (e.stopPropagation) + e.stopPropagation(); + + o.oldzidx = o.style.zIndex; + o.style.zIndex = 10; + + var y = parseInt(o.vmode ? o.root.style.top : o.root.style.bottom); + var x = parseInt(o.hmode ? o.root.style.left : o.root.style.right ); + o.root.onDragStart(x, y); + + o.lastMouseX = e.clientX; + o.lastMouseY = e.clientY; + + if (o.hmode) { + if (o.minX != null) o.minMouseX = e.clientX - x + o.minX; + if (o.maxX != null) o.maxMouseX = o.minMouseX + o.maxX - o.minX; + } else { + if (o.minX != null) o.maxMouseX = -o.minX + e.clientX + x; + if (o.maxX != null) o.minMouseX = -o.maxX + e.clientX + x; + } + + if (o.vmode) { + if (o.minY != null) o.minMouseY = e.clientY - y + o.minY; + if (o.maxY != null) o.maxMouseY = o.minMouseY + o.maxY - o.minY; + } else { + if (o.minY != null) o.maxMouseY = -o.minY + e.clientY + y; + if (o.maxY != null) o.minMouseY = -o.maxY + e.clientY + y; + } + + // console.log("assign"); + document.onmousemove = xynt_dd.prototype.drag; + document.onmouseup = xynt_dd.prototype.end; + + for(var i = 0 ; i < o.xynt_conn_ected.length ; i++) { + o.xynt_conn_ected[i].xynt_conn_update('start', o); + } + + return false; + }, + + drag : function(e) + { + e = xynt_dd.prototype.fixE(e); + var o = xynt_dd.obj; + + var ey = e.clientY; + var ex = e.clientX; + var y = parseInt(o.vmode ? o.root.style.top : o.root.style.bottom); + var x = parseInt(o.hmode ? o.root.style.left : o.root.style.right ); + var nx, ny; + + if (o.minX != null) ex = o.hmode ? Math.max(ex, o.minMouseX) : Math.min(ex, o.maxMouseX); + if (o.maxX != null) ex = o.hmode ? Math.min(ex, o.maxMouseX) : Math.max(ex, o.minMouseX); + if (o.minY != null) ey = o.vmode ? Math.max(ey, o.minMouseY) : Math.min(ey, o.maxMouseY); + if (o.maxY != null) ey = o.vmode ? Math.min(ey, o.maxMouseY) : Math.max(ey, o.minMouseY); + + nx = x + ((ex - o.lastMouseX) * (o.hmode ? 1 : -1)); + ny = y + ((ey - o.lastMouseY) * (o.vmode ? 1 : -1)); + + if (o.xMapper) nx = o.xMapper(y) + else if (o.yMapper) ny = o.yMapper(x) + + xynt_dd.obj.root.style[o.hmode ? "left" : "right"] = nx + "px"; + xynt_dd.obj.root.style[o.vmode ? "top" : "bottom"] = ny + "px"; + xynt_dd.obj.lastMouseX = ex; + xynt_dd.obj.lastMouseY = ey; + + xynt_dd.obj.root.onDrag(nx, ny); + + console.log("pre call it"+o.xynt_conn_ected.length); + for(var i = 0 ; i < o.xynt_conn_ected.length ; i++) { + console.log("call it"); + o.xynt_conn_ected[i].xynt_conn_update('drag', o); + } + + return false; + }, + + end : function(e) + { + e = xynt_dd.prototype.fixE(e); + var o = xynt_dd.obj; + + o.style.zIndex = o.oldzidx; + if (o.mouseup_cb != null) { + if (o.mouseup_cb(o) == 1) { + o.onmousedown = null; + } + } + + document.onmousemove = null; + document.onmouseup = null; + xynt_dd.obj.root.onDragEnd( parseInt(xynt_dd.obj.root.style[xynt_dd.obj.hmode ? "left" : "right"]), + parseInt(xynt_dd.obj.root.style[xynt_dd.obj.vmode ? "top" : "bottom"])); + for(var i = 0 ; i < o.xynt_conn_ected.length ; i++) { + o.xynt_conn_ected[i].xynt_conn_update('end', o); + } + + xynt_dd.obj = null; + }, + + fixE : function(e) + { + if (typeof e == 'undefined') e = window.event; + if (typeof e.layerX == 'undefined') e.layerX = e.offsetX; + if (typeof e.layerY == 'undefined') e.layerY = e.offsetY; + return e; + } +}; + +Extends(xynt_dd, xynt_connect); \ No newline at end of file diff --git a/web/xynt/xynt-link.js b/web/xynt/xynt-link.js new file mode 100644 index 0000000..12ae9c1 --- /dev/null +++ b/web/xynt/xynt-link.js @@ -0,0 +1,95 @@ +function tasks_link(anc, a, b, type) { + var cur; + this.anc = anc; + this.o = document.createElement("div"); + this.o.style.top = "0px"; + this.o.style.left = "0px"; + this.o.style.position = "absolute"; + this.o.style.visibility = "hidden"; + this.beg = document.createElement("div"); + this.end = document.createElement("div"); + this.arr = document.createElement("img"); + this.arr.style.position = "absolute"; + this.o.appendChild(this.arr); + this.anc.appendChild(this.o); + for (var i = 0 ; i < 2 ; i++) { + cur = i == 0 ? this.beg : this.end; + cur.style.width = '5px'; + cur.style.height = '5px'; + cur.style.backgroundColor = 'gray'; + cur.style.visibility = 'inherit'; + cur.style.zIndex = 20; + cur.style.position = 'absolute'; + this.o.appendChild(cur); + // alert("gugu"); + } + + this.a = a; + this.b = b; + this.type = type; + + if (typeof(a.connected) != 'object') + return null; + + if (typeof(b.connected) != 'object') + return null; + + for (var i = 0 ; i < 2 ; i++) { + cur = (i == 0 ? a : b); + cur.connected[cur.connected.length++] = this; + for( ; cur.parentNode != null && cur.parentNode != anc ; cur = cur.parentNode) { + cur.connect(this); + } + } + this.update() +} + +tasks_link.prototype = { + a: null, + b: null, + type: null, + + update: function(method, obj) + { + /* + if (method == 'end') { + if (this.o.style.visibility == 'visible') + this.o.style.visibility = 'hidden'; + else + this.o.style.visibility = 'visible'; + } + */ + + // FIXME you need to user the width of the border instead of +2 + this.beg.style.left = (parseInt(this.a.style.left) + parseInt(this.a.style.width) + 2 + parseInt(this.a.parentNode.style.left))+"px"; + this.beg.style.top = (parseInt(this.a.style.top) + parseInt(((parseInt(this.a.style.height) + 2) / 2)) + parseInt(this.a.parentNode.style.top))+"px"; + this.beg.style.width = (parseInt(this.b.style.left) - (parseInt(this.a.style.left) + 2 + parseInt(this.b.style.width) + 2)+ parseInt(this.b.parentNode.style.left) + 5)+"px"; + this.beg.style.height = "1px"; + + this.end.style.left = (parseInt(this.beg.style.left) + parseInt(this.beg.style.width))+"px"; + this.arr.style.left = (parseInt(this.end.style.left) - 3)+"px"; + /* this.end.style.left = (parseInt(this.b.style.left) + parseInt(this.b.parentNode.style.left))+"px"; + this.end.style.top = (parseInt(this.b.style.top) + parseInt(this.b.parentNode.style.top))+"px"; */ + endpty = parseInt(this.b.style.top) + parseInt(this.b.parentNode.style.top)+10; + this.end.style.width = "1px"; + + if (parseInt(this.beg.style.top) < endpty) { + this.end.style.top = this.beg.style.top; + this.end.style.height = (parseInt(this.b.style.top) + parseInt(this.b.parentNode.style.top) - ((parseInt(this.a.style.top) + parseInt(this.a.parentNode.style.top))) ) - 11 +"px"; + this.arr.style.top = (parseInt(this.end.style.top) + parseInt(this.end.style.height) - 5)+"px"; + this.arr.src = "img/arrow_do.png"; + } + else { + this.end.style.top = (parseInt(this.b.style.top) + parseInt(this.b.parentNode.style.top) + 23)+"px"; + this.end.style.height = (parseInt(this.a.style.top) + parseInt(this.a.parentNode.style.top) - ((parseInt(this.b.style.top) + parseInt(this.b.parentNode.style.top))) ) - 11 +"px"; + + this.arr.style.top = this.end.style.top; + this.arr.src = "img/arrow_up.png"; + } + + + this.o.style.visibility = "visible"; + + console.log("met: " + method + " obj: " + (obj == this.a ? "Obj A" : (obj == this.b ? "Obj B" : "Other")) ); + } +} diff --git a/xynt-base-test.js b/xynt-base-test.js deleted file mode 100644 index 2b45c79..0000000 --- a/xynt-base-test.js +++ /dev/null @@ -1,139 +0,0 @@ -function A(a, b) { - this.a_dyn = "A DYN"; - this.a = a; - this.b = b; -} - -A.prototype = { - a_stat: "A STAT", - - a_func: function () { - console.log("a_func run"); - }, - aa_func: function () { - console.log("aa_func run in A class"); - } -} - -function B(a, b) { - this.b_dyn = "B DYN"; - A.call(this, a, b); -} - -B.prototype = { - b_stat: "B STAT", - - a_func: function () { - console.log("a_func run from B"); - console.log("and now try to call the super method"); - this.callSuper("a_func"); - }, - - b_func: function () { - console.log("b_func run"); - } -} -function C() { - this.c_dyn = "C DYN"; -} - -C.prototype = { - c_stat: "C STAT", - - aa_func: function () { - console.log("aa_func run in C class"); - }, - - c_func: function () { - console.log("c_func run"); - } -} - -Extends(B, A); - -function print_dynstat(inst, name) -{ - for (i = 0 ; i < inst.length ; i++) { - console.log(name[i]+".a_dyn: "+inst[i].a_dyn); - console.log(name[i]+".a_stat: "+inst[i].a_stat); - if (name[i][0] == 'b') { - console.log(name[i]+".b_dyn: "+inst[i].b_dyn); - console.log(name[i]+".b_stat: "+inst[i].b_stat); - } - if (name[i][0] == 'c') { - console.log(name[i]+".c_dyn: "+inst[i].c_dyn); - console.log(name[i]+".c_stat: "+inst[i].c_stat); - } - } -} - -window.onload = function () { - console.log("Window.onload: begin"); - show_class(A); - show_class(B); - show_class(C); - - a1 = new A(1,2); - a2 = new A(3,4); - b1 = new B(5,6); - c1 = new C(); - - arr_inst = [ a1 , a2 , b1 , c1 ]; - arr_name = [ "a1", "a2", "b1", "c1" ]; - - print_dynstat(arr_inst, arr_name); - - console.log("---"); - console.log("ACTION: a1.a_stat = \"CHANGED\";"); - a1.a_stat = "CHANGED"; - - print_dynstat(arr_inst, arr_name); - - console.log("---"); - console.log("ACTION: A.prototype.a_stat = \"PROTO CHANGED\""); - A.prototype.a_stat = "PROTO CHANGED"; - - print_dynstat(arr_inst, arr_name); - - console.log("---"); - console.log("ACTION: ExtendsInst(c1, A, [1, 33])"); - - var ext = ExtendsInst(c1, A, [1, 33]); - console.log("ExtInst: "+(ext == true ? "TRUE" : "FALSE")); -// } function azaz() { - print_dynstat(arr_inst, arr_name); - - console.log("---"); - console.log("ACTION: B.prototype.a_stat = \"PROTO CHANGED\""); - B.prototype.a_stat = "PROTO CHANGED"; - - print_dynstat(arr_inst, arr_name); - - console.log("---"); - console.log("ACTION: A.prototype.a_stat = \"PROTO CHANGED 2\""); - console.log("ACTION: C.prototype.c_stat = \"PROTO CHANGED 2\""); - A.prototype.a_stat = "PROTO CHANGED 2"; - C.prototype.c_stat = "PROTO CHANGED 2"; - - print_dynstat(arr_inst, arr_name); - - console.log("---"); - console.log("=== INSTANCE b1 ==="); - show_inst(b1); - console.log("=== INSTANCE b1.a_func() ==="); - b1.a_func(); - console.log("=== INSTANCE b1.b_func() ==="); - b1.b_func(); - - console.log("---"); - console.log("=== INSTANCE c1 ==="); - show_inst(c1); - console.log("=== INSTANCE c1.a_func() ==="); - c1.a_func(); - console.log("=== INSTANCE c1.aa_func() ==="); - c1.aa_func(); - console.log("=== INSTANCE c1.callSuper aa_func() ==="); - c1.callSuper("aa_func"); - console.log("=== INSTANCE c1.c_func() ==="); - c1.c_func(); -} \ No newline at end of file diff --git a/xynt-base.js b/xynt-base.js deleted file mode 100644 index de7cd25..0000000 --- a/xynt-base.js +++ /dev/null @@ -1,179 +0,0 @@ - -function Extends(sub) -{ - var proto; - thinF = function(){}; - inh = new thinF(); - inh.xynt_sup = []; - inh.xynt_sup_cl = []; - - console.log("EXT START"); - - var multi = function(sub, super, is_last) - { - var proto = super.prototype; - - for (var f in proto) { - if (f == "xynt_sup" || f == "xynt_sup_cl") - continue; - - console.log("LOOP: "+f); - if( f != "constructor" && typeof(proto[f]) == "function" && !is_last){ - console.log("M_FU: "+proto[f]+" F: "+f); - // sub[f] = proto[f]; - sub[f] = function() { - // console.log("INFU PR: " + proto[f] + " FUNC: "+f+" THIS: " + this); - console.log("SIMPLE LOG"); - return proto[f].apply(this,arguments); - } - } - else { - console.log("M_PR: "+proto.name+" A: "+f+" FUN: "+proto[f]); - sub[f] = proto[f]; - } - } - } - - for( var i=1; i < arguments.length ; i++){ - multi(inh, arguments[i], false); - inh.xynt_sup.push(arguments[i].prototype); - inh.xynt_sup_cl.push(arguments[i]); - } - - multi(inh, sub, true); - - - inh.callSuper = function(fnc){ - var len = this.xynt_sup_cl.length; - for ( var i=0 ; i/g,'>'). - replace(/\n"); - }, - - log: function(s) { - if (!this.enable) { - return; - } - if (typeof(s) == "string" || typeof(s) == "function") { - this.div.innerHTML += this.escapeHTML(s); - } - else { - ind = 4; - this.dump_obj(s,ind); - } - this.div.innerHTML += "
\n"; - this.win.document.body.scrollTop = 10000000; - }, - - dump_obj: function(s, ind) { - var sind = ""; - - sind = ""; - for (i = 0 ; i < ind ; i++) { - sind += " "; - } - sind += ""; - for (i in s) { - if (typeof(s[i]) == 'string' || typeof(s[i]) == "function") { - var ret = ""; - var arr = this.escapeHTML(s[i]).split("\n"); - for (el in arr) { - ret += sind + arr[el] + "\n"; - } - // this.div.innerHTML += "xx["+this.escapeHTML(i) + "] : [" + ret + "]

\n"; - this.div.innerHTML += this.escapeHTML(i)+"
\n"; - this.div.innerHTML += ret + "

\n"; - } - else { - this.dump_obj(s[i], ind+4); - } - } - // this.div.innerHTML += "post-loop
"; - }, - - logger: function(s) { - if (!this.enable) { - return; - } - this.div.innerHTML += s + "
"; - this.win.document.body.scrollTop = 10000000; - }, - - close: function() { - if (this.enable) { - this.win.close(); - } - } -} - -/* - * create and destroy - */ -var is_xynt_console = false; -var console_enable = true; - -if(typeof(console) == "undefined") { - var console; - - console = new xynt_console(console_enable); - - is_xynt_console = true; -} -else { - // console.logger = console.log; - // console.log = function () { return 0; } -} - -function deconsole() { - if (is_xynt_console) { - console.close(); - } -} - -function log_walk(curtag) -{ - var ind = 0; - var ancestor = curtag; - do { - console.log(spcs("_", "+", ind)+" ["+curtag.tagName+"] nodeType: "+curtag.nodeType+" inner: ["+curtag.innerHTML+"]"); - if (curtag.firstChild != null && curtag.tagName != "TD") { - ind += 2; - curtag = curtag.firstChild; - } - else if (curtag.nextSibling != null) { - curtag = curtag.nextSibling; - } - else if (curtag.parentNode.nextSibling != null) { - ind -= 2; - curtag = curtag.parentNode.nextSibling; - } - else - curtag = null; - } while (curtag != null && curtag != ancestor); -} - - diff --git a/xynt-dd-test.js b/xynt-dd-test.js deleted file mode 100644 index 3cc8e54..0000000 --- a/xynt-dd-test.js +++ /dev/null @@ -1,8 +0,0 @@ -function dropt1() -{ - ; //alert("t1"); -} -window.onload = function() { - console.log("HT"+$('t1')); - xynt_dd.call($('t1'), dropt1, -1600, 1600, 10,10); -} \ No newline at end of file diff --git a/xynt-dd.js b/xynt-dd.js deleted file mode 100644 index f9eec36..0000000 --- a/xynt-dd.js +++ /dev/null @@ -1,202 +0,0 @@ -/* - * brisk - dom-drag.js - * - * Copyright (C) 2006-2011 Matteo Nastasi - * mailto: nastasi@alternativeoutput.it - * matteo.nastasi@milug.org - * web: http://www.alternativeoutput.it - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABLILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. You should have received a - * copy of the GNU General Public License along with this program; if - * not, write to the Free Software Foundation, Inc, 59 Temple Place - - * Suite 330, Boston, MA 02111-1307, USA. - * - */ - -/************************************************** - * dom-drag.js - * 09.25.2001 - * www.youngpup.net - ************************************************** - * 10.28.2001 - fixed minor bug where events - * sometimes fired off the handle, not the root. - **************************************************/ - -function xynt_dd(mouseup_cb, minX, maxX, minY, maxY, bSwapHorzRef, bSwapVertRef, fXMapper, fYMapper) -{ - xynt_connect.call(this); - - this.onmousedown = xynt_dd.prototype.start; - this.mouseup_cb = mouseup_cb; - - this.hmode = bSwapHorzRef ? false : true ; - this.vmode = bSwapVertRef ? false : true ; - - this.root = (this.xynt_dom_el && this.xynt_dom_el != null) ? this.xynt_dom_el : this ; - - if (this.hmode && isNaN(parseInt(this.root.style.left))) { - var res = parseInt(getStyle(o, "left", "left")); - if (isNaN(res)) { - this.root.style.left = "0px"; - } - else { - this.root.style.left = res; - } - } - if (this.vmode && isNaN(parseInt(this.root.style.top ))) { - var res = parseInt(getStyle(o, "top", "top")); - if (isNaN(res)) { - this.root.style.top = "0px"; - } - else { - this.root.style.top = res; - } - } - if (!this.hmode && isNaN(parseInt(this.root.style.right ))) this.root.style.right = "0px"; - if (!this.vmode && isNaN(parseInt(this.root.style.bottom))) this.root.style.bottom = "0px"; - - this.minX = typeof minX != 'undefined' ? minX : null; - this.minY = typeof minY != 'undefined' ? minY : null; - this.maxX = typeof maxX != 'undefined' ? maxX : null; - this.maxY = typeof maxY != 'undefined' ? maxY : null; - - this.xMapper = fXMapper ? fXMapper : null; - this.yMapper = fYMapper ? fYMapper : null; - - this.root.onDragStart = new Function(); - this.root.onDragEnd = new Function(); - this.root.onDrag = new Function(); -} - -xynt_dd.prototype = { - - obj : null, - - start : function(e) - { - var o = xynt_dd.obj = this; - e = xynt_dd.prototype.fixE(e); - - if (!e) - var e = window.event - // handle event - e.cancelBubble = true; - if (e.stopPropagation) - e.stopPropagation(); - - o.oldzidx = o.style.zIndex; - o.style.zIndex = 10; - - var y = parseInt(o.vmode ? o.root.style.top : o.root.style.bottom); - var x = parseInt(o.hmode ? o.root.style.left : o.root.style.right ); - o.root.onDragStart(x, y); - - o.lastMouseX = e.clientX; - o.lastMouseY = e.clientY; - - if (o.hmode) { - if (o.minX != null) o.minMouseX = e.clientX - x + o.minX; - if (o.maxX != null) o.maxMouseX = o.minMouseX + o.maxX - o.minX; - } else { - if (o.minX != null) o.maxMouseX = -o.minX + e.clientX + x; - if (o.maxX != null) o.minMouseX = -o.maxX + e.clientX + x; - } - - if (o.vmode) { - if (o.minY != null) o.minMouseY = e.clientY - y + o.minY; - if (o.maxY != null) o.maxMouseY = o.minMouseY + o.maxY - o.minY; - } else { - if (o.minY != null) o.maxMouseY = -o.minY + e.clientY + y; - if (o.maxY != null) o.minMouseY = -o.maxY + e.clientY + y; - } - - // console.log("assign"); - document.onmousemove = xynt_dd.prototype.drag; - document.onmouseup = xynt_dd.prototype.end; - - for(var i = 0 ; i < o.xynt_conn_ected.length ; i++) { - o.xynt_conn_ected[i].xynt_conn_update('start', o); - } - - return false; - }, - - drag : function(e) - { - e = xynt_dd.prototype.fixE(e); - var o = xynt_dd.obj; - - var ey = e.clientY; - var ex = e.clientX; - var y = parseInt(o.vmode ? o.root.style.top : o.root.style.bottom); - var x = parseInt(o.hmode ? o.root.style.left : o.root.style.right ); - var nx, ny; - - if (o.minX != null) ex = o.hmode ? Math.max(ex, o.minMouseX) : Math.min(ex, o.maxMouseX); - if (o.maxX != null) ex = o.hmode ? Math.min(ex, o.maxMouseX) : Math.max(ex, o.minMouseX); - if (o.minY != null) ey = o.vmode ? Math.max(ey, o.minMouseY) : Math.min(ey, o.maxMouseY); - if (o.maxY != null) ey = o.vmode ? Math.min(ey, o.maxMouseY) : Math.max(ey, o.minMouseY); - - nx = x + ((ex - o.lastMouseX) * (o.hmode ? 1 : -1)); - ny = y + ((ey - o.lastMouseY) * (o.vmode ? 1 : -1)); - - if (o.xMapper) nx = o.xMapper(y) - else if (o.yMapper) ny = o.yMapper(x) - - xynt_dd.obj.root.style[o.hmode ? "left" : "right"] = nx + "px"; - xynt_dd.obj.root.style[o.vmode ? "top" : "bottom"] = ny + "px"; - xynt_dd.obj.lastMouseX = ex; - xynt_dd.obj.lastMouseY = ey; - - xynt_dd.obj.root.onDrag(nx, ny); - - console.log("pre call it"+o.xynt_conn_ected.length); - for(var i = 0 ; i < o.xynt_conn_ected.length ; i++) { - console.log("call it"); - o.xynt_conn_ected[i].xynt_conn_update('drag', o); - } - - return false; - }, - - end : function(e) - { - e = xynt_dd.prototype.fixE(e); - var o = xynt_dd.obj; - - o.style.zIndex = o.oldzidx; - if (o.mouseup_cb != null) { - if (o.mouseup_cb(o) == 1) { - o.onmousedown = null; - } - } - - document.onmousemove = null; - document.onmouseup = null; - xynt_dd.obj.root.onDragEnd( parseInt(xynt_dd.obj.root.style[xynt_dd.obj.hmode ? "left" : "right"]), - parseInt(xynt_dd.obj.root.style[xynt_dd.obj.vmode ? "top" : "bottom"])); - for(var i = 0 ; i < o.xynt_conn_ected.length ; i++) { - o.xynt_conn_ected[i].xynt_conn_update('end', o); - } - - xynt_dd.obj = null; - }, - - fixE : function(e) - { - if (typeof e == 'undefined') e = window.event; - if (typeof e.layerX == 'undefined') e.layerX = e.offsetX; - if (typeof e.layerY == 'undefined') e.layerY = e.offsetY; - return e; - } -}; - -Extends(xynt_dd, xynt_connect); \ No newline at end of file diff --git a/xynt-div-coord-test.js b/xynt-div-coord-test.js deleted file mode 100644 index f678f3f..0000000 --- a/xynt-div-coord-test.js +++ /dev/null @@ -1,95 +0,0 @@ - -function dimension() -{ - //var w = getStyle(window.document.body, "width", "width"); - //var h = getStyle(window.document.body, "height", "height"); - var w = window.innerWidth; - var h = window.innerHeight; - - console.log("W: "+w+" H: "+h); - - $('board-drag').style.left = (parseInt(w) / 2 - 2)+"px"; - $('board-drag').style.top = "0px"; - /*$('board-drag').style.width = (10)+"px"; */ - $('board-drag').style.height = (parseInt(h) - 2)+"px"; - - $('board').xynt_divcoo_hidescroll = 0; - $('board').style.top = "0px"; - $('board').style.left = "0px"; - // $('board').style.width = (parseInt(w) / 2 - 2)+"px"; - $('board').style.height = (parseInt(h) - 2)+"px"; - - $('board').style.width = parseInt($('board-drag').style.left)+$('board').xynt_divcoo_hidescroll+"px"; - if (parseInt($('board').style.width) > $('board').clientWidth) { - // alert("di qui"); - $('board').xynt_divcoo_hidescroll = parseInt($('board').style.width) - $('board').clientWidth; - $('board').style.width = parseInt($('board-drag').style.left)+$('board').xynt_divcoo_hidescroll+"px"; - // $('board').style.width = (parseInt($('board').style.width) + $('board').xynt_divcoo_hidescroll)+"px"; - } - - // $('board2').style.left = (parseInt(w) / 2 - 1 + parseInt($('board-drag').style.width))+"px"; - $('board2').style.left = parseInt($('board-drag').style.left)+parseInt($('board-drag').style.width)+1+"px"; - $('board2').style.top = "0px"; - $('board2').style.width = (w - (parseInt($('board-drag').style.left)+parseInt($('board-drag').style.width)+4))+"px"; - // $('board2').style.width = (parseInt(w) / 2 - 2 - 10)+"px"; - $('board2').style.height = (parseInt(h) - 2)+"px"; - - - - var h1 = $('board2').clientHeight; - var h2 = $('board').clientHeight; - - if (h1 > h2) { - $('board2').style.height = h2+"px"; - } - else if (h2 > h1) { - $('board').style.height = h1+"px"; - } - - console.log($('board2').scrollTop); - $('board').scrollTop = $('board2').scrollTop; -} - - -function resize(event, obj) -{ - if (event == 'drag') { - var w = window.innerWidth; - - $('board').style.width = parseInt($('board-drag').style.left)-1+$('board').xynt_divcoo_hidescroll+"px"; - $('board2').style.left = parseInt($('board-drag').style.left)+parseInt($('board-drag').style.width)+1+"px"; - $('board2').style.width = (w - (parseInt($('board-drag').style.left)+parseInt($('board-drag').style.width)+4))+"px"; - console.log("conn_update: "+event); - } -} - - -function scroll() -{ - // console.log("scroll"); - // $('board').style.top = -parseInt($('board2').scrollTop)+"px"; - $('board').scrollTop = $('board2').scrollTop; -} - -function scroll2() -{ - // console.log("scroll2:"); - $('board2').scrollTop = $('board').scrollTop; -} - -function dropr1() -{ - ; //alert("t1"); -} - -window.onload = function () { - dimension(); - $('board').xynt_conn_update = resize; - var ret = ExtendsInst($('board-drag'), xynt_dd, [ dropr1, -1600, 1600, 0,0 ]); - console.log("RET: "+ret); - console.log("xynt_conn_ect-v"); - console.log($('board-drag').xynt_conn_ect); - $('board-drag').xynt_conn_ect($('board')); - // console.log($('board-drag')); - return; -} diff --git a/xynt-link.js b/xynt-link.js deleted file mode 100644 index 12ae9c1..0000000 --- a/xynt-link.js +++ /dev/null @@ -1,95 +0,0 @@ -function tasks_link(anc, a, b, type) { - var cur; - this.anc = anc; - this.o = document.createElement("div"); - this.o.style.top = "0px"; - this.o.style.left = "0px"; - this.o.style.position = "absolute"; - this.o.style.visibility = "hidden"; - this.beg = document.createElement("div"); - this.end = document.createElement("div"); - this.arr = document.createElement("img"); - this.arr.style.position = "absolute"; - this.o.appendChild(this.arr); - this.anc.appendChild(this.o); - for (var i = 0 ; i < 2 ; i++) { - cur = i == 0 ? this.beg : this.end; - cur.style.width = '5px'; - cur.style.height = '5px'; - cur.style.backgroundColor = 'gray'; - cur.style.visibility = 'inherit'; - cur.style.zIndex = 20; - cur.style.position = 'absolute'; - this.o.appendChild(cur); - // alert("gugu"); - } - - this.a = a; - this.b = b; - this.type = type; - - if (typeof(a.connected) != 'object') - return null; - - if (typeof(b.connected) != 'object') - return null; - - for (var i = 0 ; i < 2 ; i++) { - cur = (i == 0 ? a : b); - cur.connected[cur.connected.length++] = this; - for( ; cur.parentNode != null && cur.parentNode != anc ; cur = cur.parentNode) { - cur.connect(this); - } - } - this.update() -} - -tasks_link.prototype = { - a: null, - b: null, - type: null, - - update: function(method, obj) - { - /* - if (method == 'end') { - if (this.o.style.visibility == 'visible') - this.o.style.visibility = 'hidden'; - else - this.o.style.visibility = 'visible'; - } - */ - - // FIXME you need to user the width of the border instead of +2 - this.beg.style.left = (parseInt(this.a.style.left) + parseInt(this.a.style.width) + 2 + parseInt(this.a.parentNode.style.left))+"px"; - this.beg.style.top = (parseInt(this.a.style.top) + parseInt(((parseInt(this.a.style.height) + 2) / 2)) + parseInt(this.a.parentNode.style.top))+"px"; - this.beg.style.width = (parseInt(this.b.style.left) - (parseInt(this.a.style.left) + 2 + parseInt(this.b.style.width) + 2)+ parseInt(this.b.parentNode.style.left) + 5)+"px"; - this.beg.style.height = "1px"; - - this.end.style.left = (parseInt(this.beg.style.left) + parseInt(this.beg.style.width))+"px"; - this.arr.style.left = (parseInt(this.end.style.left) - 3)+"px"; - /* this.end.style.left = (parseInt(this.b.style.left) + parseInt(this.b.parentNode.style.left))+"px"; - this.end.style.top = (parseInt(this.b.style.top) + parseInt(this.b.parentNode.style.top))+"px"; */ - endpty = parseInt(this.b.style.top) + parseInt(this.b.parentNode.style.top)+10; - this.end.style.width = "1px"; - - if (parseInt(this.beg.style.top) < endpty) { - this.end.style.top = this.beg.style.top; - this.end.style.height = (parseInt(this.b.style.top) + parseInt(this.b.parentNode.style.top) - ((parseInt(this.a.style.top) + parseInt(this.a.parentNode.style.top))) ) - 11 +"px"; - this.arr.style.top = (parseInt(this.end.style.top) + parseInt(this.end.style.height) - 5)+"px"; - this.arr.src = "img/arrow_do.png"; - } - else { - this.end.style.top = (parseInt(this.b.style.top) + parseInt(this.b.parentNode.style.top) + 23)+"px"; - this.end.style.height = (parseInt(this.a.style.top) + parseInt(this.a.parentNode.style.top) - ((parseInt(this.b.style.top) + parseInt(this.b.parentNode.style.top))) ) - 11 +"px"; - - this.arr.style.top = this.end.style.top; - this.arr.src = "img/arrow_up.png"; - } - - - this.o.style.visibility = "visible"; - - console.log("met: " + method + " obj: " + (obj == this.a ? "Obj A" : (obj == this.b ? "Obj B" : "Other")) ); - } -}