Adding icon to custom element not working

786 views
Skip to first unread message

Ui UI

unread,
Feb 15, 2016, 8:12:35 PM2/15/16
to JointJS
Hi ,
I am trying to add icon to custom element, but it is not working , any help appreciated.

custom element markup: : '<g class="rotatable"><g class="scalable"><rect/></g><text class="image-glyph-icon"/><text/></g>'


function getEl(options){
        return new joint.shapes.custom.RectImage({
            size: { width: 5, height: 3 },
            attrs : {
                rect : {
                    fill : 'none',
                    stroke : 'none',
                    width: 50, height: 30
                },
                ".image-glyph-icon" : {
                    text: options.content,
                    ref : 'rect',
                    'font-size': 14,
                    'ref-x' : .5,
                    'ref-y' : .7,
                    'y-alignment' : 'middle',
                    'x-alignment' : 'middle',
                    fill : '#1a1a1a'
                },
                text : {
                    text : options.label,
                    fill : '#1a1a1a',
                    ref : 'rect',
                    'ref-y' : .9,
                   
                }
            }
        })
    }

getEl({ label: "Input", content: "&#xe6bc"});



Ui UI

unread,
Feb 16, 2016, 1:10:22 PM2/16/16
to JointJS
Hi David,
I really need help to use icons inside SVG rather images. I tried the below approach but not working.
Looks like jointjs used images all over the place rather icons. As you know the advantages of icons, it can be treated as fonts, we can change color, size, etc.. as fonts.
Could you please provide any simple example which demonstrates the use of icons inside svg element in the context of jointjs.
I tried with simple example in general, it worked, but it is not working in jointjs.
Please help.

Thanks
sreeram

jmls

unread,
Feb 18, 2016, 7:02:17 AM2/18/16
to JointJS
did you solve this ? I want to use a material design icon instead of an image

thanks

Ui UI

unread,
Mar 3, 2016, 11:05:41 AM3/3/16
to joi...@googlegroups.com
Yes, I solved it, just try to understand the custom element example mentioned in jointjs tutorial in depth.
You can refer the below link also in addition to jointjs example.


--

---
You received this message because you are subscribed to a topic in the Google Groups "JointJS" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/jointjs/WLocmF9Ptqw/unsubscribe.
To unsubscribe from this group and all its topics, send an email to jointjs+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages