25 lines
880 B
Plaintext
25 lines
880 B
Plaintext
VectorCanvas.prototype.setSize = function (width, height) {
|
|
if (this.mode === 'svg') {
|
|
this.canvas.setAttribute('width', width);
|
|
this.canvas.setAttribute('height', height);
|
|
} else {
|
|
this.canvas.style.width = width + 'px';
|
|
this.canvas.style.height = height + 'px';
|
|
this.canvas.coordsize = width + ' ' + height;
|
|
this.canvas.coordorigin = '0 0';
|
|
if (this.rootGroup) {
|
|
var paths = this.rootGroup.getElementsByTagName('shape');
|
|
for (var i = 0, l = paths.length; i < l; i++) {
|
|
paths[i].coordsize = width + ' ' + height;
|
|
paths[i].style.width = width + 'px';
|
|
paths[i].style.height = height + 'px';
|
|
}
|
|
this.rootGroup.coordsize = width + ' ' + height;
|
|
this.rootGroup.style.width = width + 'px';
|
|
this.rootGroup.style.height = height + 'px';
|
|
}
|
|
}
|
|
this.width = width;
|
|
this.height = height;
|
|
};
|