summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Berenz2016-09-29 16:59:26 +0200
committerAndreas Berenz2016-09-29 16:59:26 +0200
commit9ed413d0edd6d4d3cf79e8d56a8f43ba9d323e75 (patch)
tree555e5fc3911b97e235feeebb1a31f3c914a918c1
parent[locations] Show percent of occupied machines per location (diff)
downloadslx-admin-9ed413d0edd6d4d3cf79e8d56a8f43ba9d323e75.tar.gz
slx-admin-9ed413d0edd6d4d3cf79e8d56a8f43ba9d323e75.tar.xz
slx-admin-9ed413d0edd6d4d3cf79e8d56a8f43ba9d323e75.zip
some added comments
-rw-r--r--modules-available/roomplanner/js/grid.js32
1 files changed, 30 insertions, 2 deletions
diff --git a/modules-available/roomplanner/js/grid.js b/modules-available/roomplanner/js/grid.js
index ffa6de03..a2e56103 100644
--- a/modules-available/roomplanner/js/grid.js
+++ b/modules-available/roomplanner/js/grid.js
@@ -27,6 +27,10 @@ if (!roomplanner) var roomplanner = {
isElementResizable: function(el) {
return (!$(el).attr('noresize') && $(el).attr('itemtype') != 'pc');
},
+ /**
+ * elements with attribute itemlook ending with east, south, west or north are rotatable.
+ * if the attribute does not match to one of these directions, the rotation handle will not be added
+ */
initRotation: function(el) {
if (!(new RegExp(".*(east|south|west|north)$").test($(el).attr('itemlook')))) {
return;
@@ -63,6 +67,9 @@ if (!roomplanner) var roomplanner = {
}
});
},
+ /**
+ * adds delete handle to the element. if the item is a pc, the user has to confirm his intention
+ */
initDelete: function(el) {
$(el).append('<div class="deleteHandle glyphicon glyphicon-remove-sign"></div>');
$(el).find('.deleteHandle').click(function() {
@@ -100,7 +107,9 @@ if (!roomplanner) var roomplanner = {
$(el).tooltip({html: true});
}
},
-
+ /**
+ * initializes draggable functionality. elements collide with elements of the same itemtype
+ */
initDraggable: function(el) {
$(el).draggable();
var options = {
@@ -137,6 +146,9 @@ if (!roomplanner) var roomplanner = {
$(el).draggable("option",o,options[o]);
}
},
+ /**
+ * initializes resizable functionality. elements collide with elements of the same itemtype
+ */
initResizable: function(el) {
if (!roomplanner.isElementResizable(el)) { return; }
@@ -260,6 +272,11 @@ if (!roomplanner) var roomplanner = {
}
});
},
+ /**
+ * serializes the elements on the drawboard.
+ * furniture and computers are considered.
+ * @NOTICE: if more itemtypes are added, they need to be implemented here, too!
+ */
serialize: function() {
var objects = {
@@ -296,6 +313,11 @@ if (!roomplanner) var roomplanner = {
return JSON.stringify(objects);
},
+ /**
+ * tries to reconstruct a serialized room.
+ * furniture and computers are considered
+ * @NOTICE: if new itemtypes are added to the application, they need to be implemented here, too!
+ */
load: function(object) {
if (typeof object === 'string') {
try {
@@ -458,6 +480,10 @@ $(document).ready(function(){
}
});
+ /**
+ * adds droppable functionality to the draw area for the elements.
+ * drop event is only fired for elements added to the board from the toolbar.
+ */
$('#draw-element-area').droppable({
accept: ".draggable",
drop: function(event, ui) {
@@ -570,7 +596,9 @@ $(document).ready(function(){
}
});
-
+ /**
+ * adds draggable functionality to all elements from the toolbar
+ */
$('.draggable').draggable({
helper: "clone",
//grid : [(roomplanner.settings.scale / 4), (roomplanner.settings.scale / 4)],