andyhill Posted January 26, 2022 Share Posted January 26, 2022 HTMLFrame.Height is the physical display frame height, not the contents canvas length (partially visible, partially hidden - scrolled) within. I need a way to calculate the HTMLFrame virtual canvas contents total height, please advise - thanks in advance. Link to comment Share on other sites More sharing options...
Ron Posted January 26, 2022 Share Posted January 26, 2022 This is the code I use in the HTMLFrame called daycalFrame on MainForm, where I want the canvas to fill the whole frame, making sure redrawing is done on each resize: <canvas id="daycal"> <script type="text/javascript"> var canvas = $('#daycal')[0]; var ctx = canvas.getContext("2d"); window.addEventListener('resize', resizeCanvas, true); function resizeCanvas() { canvas.width = MainForm.daycalFrame.getWidth(); canvas.height = MainForm.daycalFrame.getHeight(); drawStuff(); } </script> Link to comment Share on other sites More sharing options...
andyhill Posted January 26, 2022 Author Share Posted January 26, 2022 Thanks Ron for your reply. I do not want to change the HTMLFrame size as it is sized automatically via Flex. What I want to do is get the new canvas height (length) after contents loaded. -------------------- | | | Screen | | | |-------------------| | | | | | Off Screen | | Scrolled Into | | View | | | | | | | |-------------------| I Need to get the total Height (length) of both Screen Display Value and Off Screen Value that can be sent via an ajaxRequest for recording. Link to comment Share on other sites More sharing options...
andyhill Posted January 27, 2022 Author Share Posted January 27, 2022 Hi Sherzod, can you please advise - thanks Link to comment Share on other sites More sharing options...
Sherzod Posted January 28, 2022 Share Posted January 28, 2022 On 1/27/2022 at 12:27 AM, andyhill said: HTMLFrame.Height is the physical display frame height, not the contents canvas length (partially visible, partially hidden - scrolled) within. I need a way to calculate the HTMLFrame virtual canvas contents total height, please advise - thanks in advance. Hello @andyhill Sorry, of course not always, but sometimes a minimal test case helps us. Link to comment Share on other sites More sharing options...
Ron Posted January 28, 2022 Share Posted January 28, 2022 Quote I do not want to change the HTMLFrame size as it is sized automatically via Flex. The code I presented does not change the HTMLFrame size, but only the canvas size. It makes the canvas fill the HTMLFrame, as the frame resizes. The code makes sure your canvas is always filling the frame. If you want to know the size of the canvas, you can get it from canvas.height and canvas.width, through an ajax call. Link to comment Share on other sites More sharing options...
andyhill Posted January 29, 2022 Author Share Posted January 29, 2022 Ron, the canvas will always be bigger than the frame on screen because it's contents are larger than the frame, I want to keep the canvas' correct rendered size even though it is partially out of view - but I want to calculate (send result via ajax) the total canvas height (not change it). Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now