andrejilderda/Sketch-Copy-Paste-Position-Size

57.1 - Not able to copy/paste decimal point values

Closed this issue · 4 comments

I am copying values that have decimal points from width/height and x/y position, but when I paste to other symbols it rounds to nearest whole number instead of original copied value. Thanks!

Hi hershington, this is intentional since I don't want my objects to sit on subpixels. But, it is fairly simple to change this. Just remove all Math.round(...)'s in copy-paste-position-size.js. Let me know if you need help.

@ajilderda Then can this depend on the Pixel Fitting Preference? I think this would cover all bases.

image

Wonderful plugin, by the way. In my workflow, it is extremely valuable. Thank you.

@jayliu50 That is actually a pretty good idea. It seems we should be able to get a global setting from Sketch with Settings.globalSettingForKey('my-key') (see: https://developer.sketch.com/reference/api/#settings), but I can't find what keys are available. A couple of things I've quickly tried, like pixel-fitting returned undefined... Do you have an idea?

I've just pushed an update so that the pixel-fitting setting is respected (in stead of rounding all values by default):
https://github.com/ajilderda/Sketch-Copy-Paste-Position-Size/releases/latest/download/sketch-copy-paste-position-size.sketchplugin.zip