1
0
Fork 0

canvas/api.nas add getSize() method

This commit is contained in:
Henning Stahlke 2019-05-05 23:19:37 +02:00
parent 406aa96ecf
commit 6f4e7d91af

View file

@ -283,6 +283,11 @@ var Element = {
return center;
},
getSize: func {
var bb = me.getTightBoundingBox();
return [bb[2] - bb[0], bb[3] - bb[1]];
},
# convert bounding box vector into clip string (yes, different order)
boundingbox2clip: func(bb) {
return sprintf("rect(%d,%d,%d,%d)", bb[1], bb[2], bb[3], bb[0])