Jump to content
Search Community

danut

Members
  • Posts

    1
  • Joined

  • Last visited

danut's Achievements

0

Reputation

  1. Hello, I am trying to scale a rectangle, based on it's initial transformation matrix and on it's final one. The scaling phase is done using the scaleSelection() function from the TransformManager.as file. It is working fine for all cases, except the one when the rectangle is initially rotated, and only after that the scaling applies. Here are my input data: initial transformation matrix: a = 0.85 b = -0.51 c = 0.51 d = 0.85 tx = 75 ty = 124.05 width = 140 height = 116 final transformation matrix (after the rectangle is scaled): a = 1.48 b = 0.88 c = 0.90 d = 1.52 tx = 196.45 ty = 113 width = 243 height = 203 The modified scaleSelection() function looks like this: //I added two more parameters (the initial matrix- initialMatrix and the final matrix- sMatrix) //After the scaling phase I added a translation to place the rectangle in the right position. This is not working when the rectangle is rotated before public function scaleSelection($sx:Number, $sy:Number, $dispatchEvents:Boolean = true, sMatrix:Object = null, initialMatrix:Object = null) { //same as before var tx:Number = sMatrix.matrix.tx - (sMatrix.width - initialMatrix.width)/2; var ty:Number = sMatrix.matrix.ty - (sMatrix.height - initialMatrix.height)/2; moveSelection(sMatrix.matrix.tx - tx, sMatrix.matrix.ty - ty); } I belive that the tx and ty are not properly computed. I don't know where to add the rotation angle for the tx and ty computation. Thanks, Danut
×
×
  • Create New...