diff --git a/protovis-d3.3.js b/protovis-d3.3.js index 5529fcde..acd4f608 100644 --- a/protovis-d3.3.js +++ b/protovis-d3.3.js @@ -11,7 +11,7 @@ * the license for the specific language governing your rights and limitations. */ /*! Copyright 2010 Stanford Visualization Group, Mike Bostock, BSD license. */ - /*! b3bcf01fff70f1fcad2464fa4a700c22f9ed4596 */ + /*! 0a846e02116638f4d7f3c88a223ee1ae23f0cb3f */ /** * @class The built-in Array class. * @name Array @@ -11692,17 +11692,25 @@ pv.Mark.prototype.setPropertyValue = function(name, v, isDef, cast, chain, tag){ id: pv.id(), value: v, type: type, - tag: tag + tag: tag, + proto: null, + root: null, + + // Used in #bind to connect the property chains + // found along a mark's proto chain. + _proto: null }; + + p.root = p; - var specified = propertiesMap[name]; + var existing = propertiesMap[name]; propertiesMap[name] = p; - if(specified) { + if(existing) { // Find it and remove it for(var i = 0, P = properties.length; i < P; i++) { - if(properties[i] === specified) { + if(properties[i] === existing) { properties.splice(i, 1); break; } @@ -11711,9 +11719,9 @@ pv.Mark.prototype.setPropertyValue = function(name, v, isDef, cast, chain, tag){ properties.push(p); - if(chain && specified && type === 3) { // is a prop fun - p.proto = specified; - p.root = specified.root || specified; + if(chain && existing && type === 3) { // is a prop fun + p.proto = existing; + p.root = existing.root; } return p; @@ -12482,6 +12490,7 @@ pv.Mark.prototype.renderCore = function() { */ pv.Mark.prototype.bind = function() { var seen = {}, + root = {}, data, // Required props (no defs) @@ -12525,20 +12534,23 @@ pv.Mark.prototype.bind = function() { var pLeaf = seen[name]; if(!pLeaf) { seen[name] = p; + root[name] = p.root; + // Reset, from a previous binding + p.root._proto = null; switch(name) { case 'data': data = p; break; case 'visible': case 'id': required.push(p); break; default: types[p.type].push(p); break; } - } else if(pLeaf.type === 3) { // prop/fun - // Chain properties - // - // seen[name]-> (leaf).proto-> (B).proto-> (C).proto-> (root) - // .root-------------------------------^ - var pRoot = pLeaf.root; - pLeaf.root = p; - if(!pRoot) { pLeaf.proto = p; } - else if(!pRoot.proto) { pRoot.proto = p; } + } else { + var pRoot = root[name]; + if(pRoot.type === 3) { // prop/fun + // Chain property chains of pRoot and p + pRoot._proto = p; + pRoot = root[name] = p.root; + // Reset, from a previous binding + pRoot._proto = null; + } } } } while((mark = mark.proto)); @@ -12781,7 +12793,7 @@ pv.Mark.prototype.buildInstance = function(s) { // 3 - prop - fun function(p) { - _protoProp = p.proto; + _protoProp = p.proto || p._proto; return p.value.apply(this, _stack); } ]; @@ -22675,12 +22687,11 @@ pv.Behavior.point = function(keyArgs) { // Initialize panel. // Unpoint when the mouse leaves the pointing panel. - if(!pointingPanel && this.type === 'panel') { - + if(pointingPanel) { + ; + } else if(this.type === 'panel') { pointingPanel = this; - pointingPanel.event('mouseout', function() { - mouseout.call(pointingPanel.scene.$g); - }); + this.event('mouseout', function() { mouseout.call(this.scene.$g); }); if(stealClick) pointingPanel.addEventInterceptor('click', eventInterceptor); } else { diff --git a/protovis-r3.3.js b/protovis-r3.3.js index b5890e89..704783ca 100644 --- a/protovis-r3.3.js +++ b/protovis-r3.3.js @@ -11,7 +11,7 @@ * the license for the specific language governing your rights and limitations. */ /*! Copyright 2010 Stanford Visualization Group, Mike Bostock, BSD license. */ - /*! b3bcf01 */ + /*! 0a846e0 */ var a;if(!Array.prototype.map)Array.prototype.map=function(b,c){for(var e=this.length,d=new Array(e),f=0;f>>0,d=0;d=e)throw new Error("reduce: no values, no initial value");}for(;d>>0;for(c=!isFinite(c)||c<0?0:c>this.length?this.length:c;c1?c:null)}; pv.Mark.prototype.propertyMethod=function(b,c,e){e||(e=pv.Mark.cast[b]);this[b]=function(d,f){if(c&&this.scene){var g=this.scene.defs;if(arguments.length){g[b]={id:d==null?0:pv.id(),value:d!=null&&e?e(d):d};return this}return(g=g[b])?g.value:null}if(arguments.length){this.setPropertyValue(b,d,c,e,false,f);return this}g=this.instance();if(pv.propBuildMark===this&&pv.propBuilt[b]!==1){pv.propBuilt[b]=1;return g[b]=this.evalProperty(this.binds.properties[b])}return g[b]}}; pv.Mark.funPropertyCaller=function(b,c){function e(){var f=b.apply(this,d);return f!=null?c(f):f}var d=pv.Mark.stack;return e}; -pv.Mark.prototype.setPropertyValue=function(b,c,e,d,f,g){e=!e<<1|typeof c==="function";if(e&1&&d)c=pv.Mark.funPropertyCaller(c,d);else if(c!=null&&d)c=d(c);var h=this.$propertiesMap;d=this.$properties;c={name:b,id:pv.id(),value:c,type:e,tag:g};g=h[b];h[b]=c;if(g){b=0;for(h=d.length;b=d.length;q&&d.unshift(null);if(k.hasOwnProperty("index"))c(k,m,o,q);else{for(var l=0,n=k.scene.length;lf)d.length=f;throw j;}}; -a.bind=function(){function b(m){do for(var o=m.$properties,q=o.length;q--;){var l=o[q],n=l.name,p=c[n];if(p){if(p.type===3){n=p.root;p.root=l;if(n){if(!n.proto)n.proto=l}else p.proto=l}}else{c[n]=l;switch(n){case "data":e=l;break;case "visible":case "id":d.push(l);break;default:f[l.type].push(l);break}}}while(m=m.proto)}var c={},e,d=[],f=[[],[],[],[]];b(this);b(this.defaults);var g=f[0],h=f[1].reverse(),i=f[2];f[3].reverse();var j=this;do for(var k in j.properties)k in c||i.push(c[k]={name:k,type:2, -value:null});while(j=j.proto);if(g.length||h.length){g=g.concat(h);h=0;for(i=g.length;hi.id)d[h.name]={id:0,value:h.type&1?h.value.apply(this,b):h.value}}e=this.evalProperty(this.binds.data);d=e.length;if(c.length=d){g=pv.Mark.prototype; b.unshift(null);h=pv.propBuildMark;i=pv.propBuilt;pv.propBuildMark=this;try{for(f=0;f0.98?1:0.5}function f(t,r,w,v,y,x){function A(){if(E&&x<=0)return-1;B=z.distance2(w,l);if(E&&pv.floatLess(x,B.cost))return-2;if(s&&!D&&pv.floatLess(p,B.dist2))return-3;if(C===v.hasArea){if(Dv.inside)return+1}else{if(m){if(!D&&v.inside)return-5; if(D&&!v.inside)return+2}if(!C&&v.inside===2){if(D===2)return+3;if(D===0&&pv.floatLess(3,B.cost))return-6}else if(C&&D===2){if(v.inside===2)return-7;if(v.inside===0&&pv.floatLess(3,v.cost))return+4}}if(!(m&&D)){if(pv.floatLess(v.dist2,B.dist2))return-8;if(pv.floatLess(B.dist2,v.dist2))return+5}if(m&&pv.floatLess(B.cost,v.cost))return+6;return-9}var z=t.mark.getShape(t,r),C=z.hasArea(),D=!z.containsPoint(w,l)?0:!m||z.containsPoint(w)?2:1,E=isFinite(x)&&D<2,B,F=A();j&&function(){if(F<-3||F>0){var G= t&&t.mark;console.log("POINT "+(F>0?"choose":"skip")+" ("+F+") "+(G?G.type+" "+r:"none")+" in="+D+" d2="+(B&&B.dist2)+" cost="+(B&&B.cost)+" opaq="+(y===1))}}();if(F>0){v.hasArea=C;v.inside=D;v.dist2=B.dist2;v.cost=B.cost;v.scenes=t;v.index=r;v.shape=z;if(C&&D===2&&y===1)return true}}function g(){var t=pv.event;j&&console.log("POINT MOUSE MOVE BEG");try{var r={cost:Infinity,dist2:Infinity,inside:0,hasArea:false,x:t.pageX||0,y:t.pageY||0};if(!(k&&u&&pv.Shape.dist2(r,k).cost (leaf).proto-> (B).proto-> (C).proto-> (root) - // .root-------------------------------^ - var pRoot = pLeaf.root; - pLeaf.root = p; - if(!pRoot) { pLeaf.proto = p; } - else if(!pRoot.proto) { pRoot.proto = p; } + } else { + var pRoot = root[name]; + if(pRoot.type === 3) { // prop/fun + // Chain property chains of pRoot and p + pRoot._proto = p; + pRoot = root[name] = p.root; + // Reset, from a previous binding + pRoot._proto = null; + } } } } while((mark = mark.proto)); @@ -1387,7 +1399,7 @@ pv.Mark.prototype.buildInstance = function(s) { // 3 - prop - fun function(p) { - _protoProp = p.proto; + _protoProp = p.proto || p._proto; return p.value.apply(this, _stack); } ];