Quantcast
Channel: SCN : All Content - SAPUI5 Developer Center
Viewing all articles
Browse latest Browse all 6178

Redraw Canvas on resize of parent contianer

$
0
0

Hi All,

I want to redraw canvas on page resize.

 

I have created sap.ui.core.HTML control who's content is one Canvas element. on afterRendering event i have draw canvas. which is working fine. I have set width to 100%(canvas) in CSS.
Problem is when user resize browser or switch from portrait to land scape mode the canvas context get shrink or streach. I want to redraw canvas on page resize. I tried follwoing but it didnt work

 

var html1 = new sap.ui.core.HTML("html1", {

  content:

                "<canvas id='myCanvas' class='test'></canvas>",

             afterRendering: oController.renderCanvas                    //Perfectly draw canvas base on current page size

  });

 

html1.attachEvent("onresize", html1, oController.someFunToReDrawCanvas,null); // did not get fired at all. Also tried with "resize" word

 

 

Please let me know where I have made mistake or is there any other way by which I can call redraw Canvas function of controller.


Viewing all articles
Browse latest Browse all 6178

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>