Size of objects in JS

Please choose an appropriate sub-category to post your question or topic.

Hi,

I want to double the size of an object on dragstart and use the code

this.size(‘200%’,‘200%’);

The width is changed to larger than the size of the screen, height does not change.
What am I missing?

Thanks, Rolf

P.S.: I know, I can change the size by defining the size in object state ‘Drag Start’ but in my project this messes with other things, so I cannot use that.

Hi Rolf,

The code you’re using is meant to compare to the parent size, rather than comparing an object to its own size. In this case it refers to a group of question’s answer area. So, when you set it to 200%, it actually means doubling the size of the whole group twice.

If you want to double the size of an object, it’s better to use the “scale” function instead of “size.” Here’s an example: this.scale(2.0, 2.0);
For more information, you can refer to page 331 of the User Manual.

Best regards,

1 Like