2012-09-20 02:43:39 +04:00
|
|
|
(function () {
|
2013-08-10 14:11:16 +04:00
|
|
|
var ns = $.namespace("pskl");
|
2012-09-20 02:43:39 +04:00
|
|
|
|
2013-08-10 14:11:16 +04:00
|
|
|
ns.CanvasUtils = {
|
|
|
|
createCanvas : function (width, height, classList) {
|
|
|
|
var canvas = document.createElement("canvas");
|
|
|
|
canvas.setAttribute("width", width);
|
|
|
|
canvas.setAttribute("height", height);
|
2012-09-20 02:43:39 +04:00
|
|
|
|
2013-08-10 14:11:16 +04:00
|
|
|
if (typeof classList == "string") {
|
|
|
|
classList = [classList];
|
|
|
|
}
|
|
|
|
if (Array.isArray(classList)) {
|
|
|
|
for (var i = 0 ; i < classList.length ; i++) {
|
|
|
|
canvas.classList.add(classList[i]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return canvas;
|
|
|
|
}
|
|
|
|
};
|
2012-09-20 02:43:39 +04:00
|
|
|
})();
|