oms-Draw/Controller.js
2016-07-05 18:11:33 +02:00

44 lines
1.1 KiB
JavaScript

(function (jsOMS) {
"use strict";
jsOMS.Modules.Draw = function (app) {
this.app = app;
this.editors = [];
};
jsOMS.Modules.Draw.prototype.bind = function (id) {
var temp = null;
if (typeof id !== 'undefined') {
temp = new jsOMS.Modules.Draw.Editor(document.getElementById(id));
temp.bind();
this.editors.push(temp);
} else {
var canvas = document.getElementsByClassName('m-draw');
this.editors = [];
/* Handle media forms */
for (var c = 0; c < canvas.length; c++) {
temp = new jsOMS.Modules.Draw.Editor(canvas[c]);
temp.bind();
this.editors.push(temp);
}
}
};
jsOMS.Modules.Draw.prototype.getElements = function() {
return this.editors;
};
jsOMS.Modules.Draw.prototype.count = function() {
return this.editors.length;
};
}(window.jsOMS = window.jsOMS || {}));
jsOMS.ready(function () {
window.omsApp.moduleManager.get('Draw').bind();
});