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

1 hour ago, augusto.pellis said:

If interesting for anyone, the issue was the SVG having the same field id set with the same value. That created the not resizing issue.

Yes.

So is everything working as it should?

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...