summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjiteshjha2016-07-07 15:03:37 +0530
committerjiteshjha2016-07-07 15:03:37 +0530
commit36ebce7a4e7db5fa3e04e5c9b00fb5760619fbeb (patch)
treefafe54a8e2594374e373c4557833244aeccd7983
parentd1a5f55492fb39bbf2536f673edbfc471c81b86c (diff)
downloadxcos-on-web-36ebce7a4e7db5fa3e04e5c9b00fb5760619fbeb.tar.gz
xcos-on-web-36ebce7a4e7db5fa3e04e5c9b00fb5760619fbeb.tar.bz2
xcos-on-web-36ebce7a4e7db5fa3e04e5c9b00fb5760619fbeb.zip
Explanation
-rw-r--r--index.html36
1 files changed, 36 insertions, 0 deletions
diff --git a/index.html b/index.html
index 9c3c3aa..da5b9a7 100644
--- a/index.html
+++ b/index.html
@@ -2152,15 +2152,51 @@
var node = enc.encode(details);
var temp = enc.encode(parent);
+ /*
+ * @jiteshjha
+ */
+
+ // Get the stylesheet for the graph
var stylesheet = graph.getStylesheet();
+
+ // From the stylesheet, get the style of the particular block
var style = stylesheet.styles[name];
+
+ /*
+ * When a particular block is loaded for the first time,
+ * the image in the style of the block will be a path to the image.
+ * Set the label in the style property of the block has a html image,
+ * and set the image in the style property as null
+ *
+ * NOTE: Since the image of any block need not be changed for
+ * for every movement of that block, the image must be
+ * set only once.
+ */
if(style != null && style['image'] != null) {
+
+ // Make label as a image html element
var label = '<img src="' + style['image'] + '" height="80" width="80">';
+
+ // Set label
style['label'] = label;
+
+ // Set image as null
style['image'] = null;
+
+ // Add the label as a part of node
node.setAttribute('label', label);
}
+
+ /*
+ * If a particular block with image tag in it's style property
+ * has been invoked already, the image tag would be null for any
+ * successive instances of the same block. Hence, set the label
+ * from the label tag in style which was set when that blockModel
+ * was invoked on the first time.
+ */
if(style!= null && style['label'] != null) {
+
+ // Set label from the label field in the style property
node.setAttribute('label', style['label']);
}