ID:2251465
 
Using hud objects for interfaces what would be an efficient way to scale a whole group of objects while retaining relative distances??

EDIT: So far I tried finding the relative distance before the scaling and adjusting that by the scale factor but is there a better way??

something like this
proc/ScaleHud(var/obj/a)      //a is the parent window holding other objects
var/matrix/m=matrix()
m.Scale(0.75)
a.transform=m

for(var/obj/o in a.Children) //apply scaling and new locs in children
o.transform=m
o.screen_loc=GetNewScreenLoc(o,a,0.75)

//GetNewScreenLoc calculates the new relative distance between parent and child and returns the final location of child

this works but is there a better way?? I mean initial location is lost with this method so after many scalings Im afraid of data loss