diff --git a/build.xml b/build.xml
index f27aa573..6278ccc5 100755
--- a/build.xml
+++ b/build.xml
@@ -40,7 +40,17 @@
-
+
+
+
+
+
+
+
+
+
+
+
diff --git a/resource/web/js/svg.title.js b/resource/web/js/svg.title.js
new file mode 100755
index 00000000..6dc1cc13
--- /dev/null
+++ b/resource/web/js/svg.title.js
@@ -0,0 +1,26 @@
+// Title Plugin
+// Source: https://github.com/wout/svg.js/issues/147
+//
+// // example usage
+// var draw = SVG('drawing')
+// var group = draw.group()
+// group.title('This is a pink square.')
+// group.rect(100,100).fill('#f06')
+
+SVG.Title = SVG.invent({
+ create: 'title',
+ inherit: SVG.Element,
+ extend: {
+ text: function(text) {
+ while (this.node.firstChild)
+ this.node.removeChild(this.node.firstChild)
+ this.node.appendChild(document.createTextNode(text))
+ return this
+ }
+ },
+ construct: {
+ title: function(text) {
+ return this.put(new SVG.Title).text(text)
+ }
+ }
+})
diff --git a/resource/web/map.tmpl b/resource/web/map.tmpl
index 6bbbc323..9e2b536e 100755
--- a/resource/web/map.tmpl
+++ b/resource/web/map.tmpl
@@ -43,6 +43,7 @@
+
@@ -139,17 +140,22 @@
// Sensors
$.each(json.sensors, function(i, sensor) {
- var device = svg.image("/img/temperature.png").addClass("draggable").addClass("sensor");
- device.x(sensor.x);
- device.y(sensor.y);
- device.attr("device-id", sensor.id);
+ var group = svg.group();
+ group.image("/img/temperature.png")
+ .addClass("draggable").addClass("sensor")
+ .x(sensor.x).y(sensor.y)
+ .attr("device-id", sensor.id)
+ group.title(sensor.name);
});
// Events
$.each(json.events, function(i, event) {
- var device = svg.image("/img/lightbulb.svg").addClass("draggable").addClass("event");
- device.x(event.x);
- device.y(event.y);
- device.attr("device-id", event.id);
+ var group = svg.group();
+ svg.image("/img/lightbulb.svg")
+ .addClass("draggable").addClass("event")
+ device.x(event.x)
+ device.y(event.y)
+ device.attr("device-id", event.id)
+ device.title(event.name);
});
});
}