Created
September 7, 2022 17:48
-
-
Save onassar/bdefa17ca9dac39d2d556b209ab42851 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* __getTopRightPosition | |
* | |
* @see https://www.figma.com/plugin-docs/api/properties/figma-showui/ | |
* @access private | |
* @param Number width | |
* @param Number height | |
* @return Object | |
*/ | |
var __getTopRightPosition = function(width, height) { | |
var zoom = figma.viewport.zoom, | |
ruleSize = 20, | |
padding = 20, | |
bounds = figma.viewport.bounds, | |
x = (bounds.x + bounds.width) - (width / zoom) - (padding / zoom), | |
y = bounds.y + (ruleSize / zoom) + (padding / zoom), | |
position = {}; | |
position.x = Math.floor(x); | |
position.y = Math.floor(y); | |
return position; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment