HTML and CSS Reference
In-Depth Information
Q.svg.appendChild(this.svg);
this.viewBox = { x: 0, y: 0, w: Q.width, h: Q.height };
this._super(scene);
},
insert: function(itm) {
if(itm.svg) { this.svg.appendChild(itm.svg); }
return this._super(itm);
},
destroy: function() {
Q.svg.removeChild(this.svg);
this._super();
},
viewport: function(w,h) {
this.viewBox.w = w;
this.viewBox.h = h;
if(this.viewBox.cx || this.viewBox.cy) {
this.centerOn(this.viewBox.cx,
this.viewBox.cy);
} else {
this.setViewBox();
}
},
centerOn: function(x,y) {
this.viewBox.cx = x;
this.viewBox.cy = y;
this.viewBox.x = x - this.viewBox.w/2;
this.viewBox.y = y - this.viewBox.h/2;
this.setViewBox();
},
setViewBox: function() {
this.svg.setAttribute('viewBox',
this.viewBox.x + " " + this.viewBox.y + " "
+
this.viewBox.w + " " + this.viewBox.h);
},
browserToWorld: function(x,y) {
var m = this.svg.getScreenCTM();
var p = this.svg.createSVGPoint();
p.x = x; p.y = y;
Search WWH ::




Custom Search