Transform object for elements

The transform object would allow to set and get the following properties:

  • width

  • height

  • left

  • top

  • rotation

  • pinSettings(position, horizontalOffset?, verticalOffset?)

Examples:

$w("#myElement").transform.width = 10; // Sets the element's width to 10 pixels
$w("#myElement").transform.left = 50; // Sets the element's horizontal position to 50 pixels
$w("#myElement").transform.rotation = 80; // Sets the element's rotation to 80 degrees
$w("#myPinnedElement").transform.pinSettings("topCenter", 20); // Sets the pinned element's position to top center and 20 pixels horizontally off
$w("#myPinnedElement").transform.pinSettings(null); // Unpins the pinned element

return $w("#myElement").transform.height; // Returns the element's height in pixels
return $w("#myPinnedElement").transform.pinSettings; // Returns an object with the element's pin settings. Example object based on the above: ["position": 20, "horizontalOffset": 20, "verticalOffset": 0]
return $w("#myNonPinnedElement").transform.pinSettings; // Returns null, in case of an element that is not pinned

I would love to have this feature!

1 Like

Yep, I would love this too