- Welcome, Guest. Please Login or Register
MindFusion  
  We have released initial version of MindFusion.Scheduling library for HTML5 & JavaScript.  
  HomeHelpSearchLoginRegister   
     
     
   
 
Page Index Toggle Pages: 1 Send Topic Print  
Not able to use class for Image
Read 206 times

Shafi   Offline
Junior Member
**
Posts: 79
Gender: male
I Love MindFusion!


   
     
 
Not able to use class for Image
Apr 26th, 2018 at 4:46pm
 
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);
 
 
 
IP Logged    
 
     

Lyubo   Offline
Full Member
***
Posts: 138
Gender: male
MindFusion team


   
     
 
Re: Not able to use class for Image
Reply #1 - Apr 27th, 2018 at 6:42am
 
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):
icon.image.src  = "pathToImage"; 



Regards,
Lyubo
 
 
 
IP Logged    
 
     

Shafi   Offline
Junior Member
**
Posts: 79
Gender: male
I Love MindFusion!


   
     
 
Re: Not able to use class for Image
Reply #2 - Apr 27th, 2018 at 9:11am
 
I would like to apply image path using class instead of direct path.
Why class not get applied on image?
 
 
 
IP Logged    
 
     

Slavcho   Offline
God Member
*****
Posts: 1395
Gender: male
tech.support


   
     
 
Re: Not able to use class for Image
Reply #3 - Apr 27th, 2018 at 9:52am
 
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.
 
 
 
IP Logged    
 
     
Page Index Toggle Pages: 1 Send Topic Print