TransformControl scale one side

Hi, I am trying to implement scale in one direction. I did it by moving in the opposite direction,
my algorithm here

scaleHandler(scale) {
          const { object, _positionStart, axis, _scaleStart, boundingBox } = this;
          const { max, min } = boundingBox;
          const width = Math.abs(max.x - min.x);
          const height = Math.abs(max.y - min.y);
          const depth = Math.abs(max.z - min.z);

          object.scale.copy(scale);

          switch (axis) {

            case "X":

              object.position.x =

                _positionStart.x -

                ((width * scale.x) / _scaleStart.x - width) / 2;

              break;

            case "Z":

              object.position.z =

                _positionStart.z -

                ((depth * scale.z) / _scaleStart.z - depth) / 2;

              break;

            case "Y":

              object.position.y =

                _positionStart.y +

                ((height * scale.y) / _scaleStart.y - height) / 2;

              break;

            default:
              break;
          }
        }

it works, but if I rotate the object, the axes also rotate and I get the wrong direction of movement. Can I fix this? I will be grateful for any help
full code here

I guess you confused the concept of the coordinate system of the object itself with the world coordinate system.Try changing the coordinate space of transformcontrol.
‘local’ : ‘world’
image

it doesnt work