Roo/svg/Element.js
authorAlan Knowles <alan@roojs.com>
Fri, 25 Jun 2021 07:17:54 +0000 (15:17 +0800)
committerAlan Knowles <alan@roojs.com>
Fri, 25 Jun 2021 07:17:54 +0000 (15:17 +0800)
Roo/svg/Element.js [new file with mode: 0644]

diff --git a/Roo/svg/Element.js b/Roo/svg/Element.js
new file mode 100644 (file)
index 0000000..336dc09
--- /dev/null
@@ -0,0 +1,57 @@
+/**
+ *
+ * The SVG element.. - with a 'g' subelement, that can handle moving / panning etc..
+ *
+ *
+ * The SVG element is the only element that handles events
+ *   if you click on it, it will look for  roo-svg-observable in the event handler and pass on events to children.
+ *
+ *   
+ * 
+ *
+ */
+
+Roo.namespace('Roo.svg');
+
+Roo.svg.Element = function(cfg)
+{
+    Roo.svg.Element.superclass.constructor.call(this, cfg);
+    this.addEvents({
+        'click' : true,
+        'dblclick' : true,
+        'context' : true
+    });
+    
+}
+
+Roo.extend(Roo.svg.Element, Roo.BoxComponent,  {
+   
+    tag : 'g',
+    
+   
+    getAutoCreate : function(){
+        
+       
+        return {
+            ns: "svg",
+            xmlns: "http://www.w3.org/2000/svg",
+            tag: this.tag,
+            cls : this.cls + ' roo-svg-observable'
+        };
+    },
+    
+    initEvents: function() 
+    {
+        Roo.svg.Canvas.superclass.initEvents.call(this);
+        // others...
+        this.el.relayEvent('click', this);
+        this.el.relayEvent('dblclick', this);
+        this.el.relayEvent('context', this);
+        
+    }
+    
+     
+    
+    
+   
+});
\ No newline at end of file