Jump to content

Panels alignment and svg resizing


augusto.pellis

Recommended Posts

Good morning, I need suggestion to solve my problem. In the testcase attached I've got a svg image embedded in a hmtframe. I put the svg source also in a label at the center of the form.

I would like the svg to draw entirely within its parent and most important to resize accordingly to the user resizing the browser window.

Any suggestions?

Thank you and stay safe.

Augusto

TestCaseImageResizing.zip

Link to comment
Share on other sites

3 hours ago, augusto.pellis said:

Hi everybody. From the example above, would it be possible to redraw the svg into the htmlframe when the browser window is resized? I guess to reassign svg's viewBox accordingly to the new dimension of its container.

is it doable?

Hi,

One possible solution I think.

UniHTMLFrame1.ClientEvents.ExtEvents ->

function afterupdatehtml(sender, eOpts)
{
    if (sender.getEl().down('svg')) {
        sender.getEl().down('svg').el.dom.setAttribute('width', sender.getWidth()+'px');
        sender.getEl().down('svg').el.dom.setAttribute('height', sender.getHeight()+'px');
    }
}

UniHTMLFrame1.ClientEvents.ExtEvents ->

function resize(sender, width, height, oldWidth, oldHeight, eOpts)
{
    if (sender.getEl().down('svg')) {
        sender.getEl().down('svg').el.dom.setAttribute('width', width+'px');
        sender.getEl().down('svg').el.dom.setAttribute('height', height+'px');
    }
}

 

  • Like 2
Link to comment
Share on other sites

About this topic I have a strange behaviour. If I set 4 copied/pasted panels in a container hbox'ed (Imean the same exact panel with same html, ext events) only the first one gets resized correctly. What do I wrong this time? :-( I attach screenshot of the container with the four panels in a row.

Mr. Sherzod I need your advice, again!

AnyDesk_2020-03-31_09-02-35.png

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...