Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Img from DrawPane

    Hi,

    I am trying to get an Img from my DrawPane but I am getting a blank image. Can you please tell me what I am doing wrong.

    I am using SmartGwt 5.0p Pro. I tried this on IE 11 and ff.

    Code:
    import com.google.gwt.core.client.EntryPoint;
    import com.smartgwt.client.widgets.Img;
    import com.smartgwt.client.widgets.drawing.DrawPane;
    import com.smartgwt.client.widgets.drawing.DrawRect;
    
    public class DrawPaneTest implements EntryPoint {
    
    	@Override
    	public void onModuleLoad() {
    		DrawPane dp = new DrawPane();
    		dp.setWidth(100);
    		dp.setHeight(100);
    		dp.setTop(100);
    		dp.setLeft(100);
    		dp.setBorder("1px solid black");
    		dp.draw();
    		
    		DrawRect dr = new DrawRect();
    		dr.setWidth(30);
    		dr.setHeight(30);
    		dr.setTop(10);
    		dr.setLeft(10);
    		dr.setFillColor("red");
    		dr.setDrawPane(dp);
    		dr.draw();
    		
    		Img i = new Img();
    		i.setID("myimg");
    		i.setWidth(100);
    		i.setHeight(100);
    		i.setTop(100);
    		i.setLeft(300);
    		i.setSrc(dp.getDataURL());
    		i.draw();
    	}
    }
    The page source shows this for the Img
    Code:
    <div class="normal" id="isc_2" style="left: 300px; top: 100px; width: 100px; height: 100px; overflow: visible; position: absolute; z-index: 200036;" onscroll="return myimg.$lh()" eventproxy="myimg">
        <div id="isc_1" style="width: 100%; vertical-align: top; display: inline-block; visibility: inherit; position: relative; z-index: 200036; cursor: default; box-sizing: border-box;" eventproxy="myimg">
            <img name="isc_1main" width="100" height="100" align="TEXTTOP" draggable="true" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGIAAABiCAYAAACrpQYOAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAA8SURBVHhe7cExAQAAAMKg9U9tCU8gAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAC5qlnIAAacfqhgAAAAASUVORK5CYII=" border="0" suppress="TRUE">
        </div>
    </div>
    Thanks.

    #2
    This was a timing issue since draw operations are delayed so that they can be performed all at once. We've now made a call to getDataURL() automatically force all draw operations to complete, so this is fixed for tomorrow's nightly builds of 4.1 and up.

    Comment


      #3
      Thanks for the fix. Looks good now.

      Comment

      Working...
      X