Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Not able to use class for Image (Read 1953 times)
Shafi
Full Member
***
Offline


I Love MindFusion!

Posts: 109
Joined: Nov 8th, 2016
Not able to use class for Image
Apr 26th, 2018 at 3:46pm
Print Post  
In css have added following class
    .ibs-icons-big-error {
        background-image: url('../../../assets/img/cmdelementnew24.svg');
    }


When add image inside using this class then it not appearing

                const icon = new MindFusion.Drawing.Image(config.actionImageRect);
                icon.image.className  = "ibs-icons-big-error";
                icon.image.name = "Action";
                icon.image.addEventListener("load", function () {
                    icon.loaded = true;
                    item.invalidate();
                });
                icon.loaded = true;
                item.getGraphicsContent().push(icon);
  
Back to top
 
IP Logged
 
Lyubo
God Member
*****
Offline


MindFusion team

Posts: 511
Joined: Jun 17th, 2010
Re: Not able to use class for Image
Reply #1 - Apr 27th, 2018 at 5:42am
Print Post  
Hi,

The image property of the MindFusion.Drawing.Image class is actually an Image DOM element, so you need to set its src attribute.

Code (Javascript)
Select All
icon.image.src  = "pathToImage"; 



Regards,
Lyubo
  
Back to top
 
IP Logged
 
Shafi
Full Member
***
Offline


I Love MindFusion!

Posts: 109
Joined: Nov 8th, 2016
Re: Not able to use class for Image
Reply #2 - Apr 27th, 2018 at 8:11am
Print Post  
I would like to apply image path using class instead of direct path.
Why class not get applied on image?
  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3152
Joined: Oct 19th, 2005
Re: Not able to use class for Image
Reply #3 - Apr 27th, 2018 at 8:52am
Print Post  
You won't be able to. The diagram is rendered using Canvas API, this image is not part of the DOM tree and not styled by the browser.
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint