focus method

dynamic focus(
  1. dynamic point,
  2. dynamic size, [
  3. dynamic amount = 1
])

Focus operation consist of positioning the point of interest in front of the camera and a slightly zoom in @param {Vector3} point The point of interest @param {Number} size Scale factor @param {Number} amount Amount of operation to be completed (used for focus animations, default is complete full operation)

Implementation

focus(point, size, [amount = 1]) {
  //move center of camera (along with gizmos) towards point of interest
  _offset.copy(point).sub(_gizmos.position).multiplyScalar(amount);
  _translationMatrix.makeTranslation(_offset.x, _offset.y, _offset.z);

  _gizmoMatrixStateTemp.copy(_gizmoMatrixState);
  _gizmoMatrixState.premultiply(_translationMatrix);
  _gizmoMatrixState.decompose(_gizmos.position, _gizmos.quaternion, _gizmos.scale);

  _cameraMatrixStateTemp.copy(_cameraMatrixState);
  _cameraMatrixState.premultiply(_translationMatrix);
  _cameraMatrixState.decompose(camera.position, camera.quaternion, camera.scale);

  //apply zoom
  if (enableZoom) {
    applyTransformMatrix(scale(size, _gizmos.position));
  }

  _gizmoMatrixState.copy(_gizmoMatrixStateTemp);
  _cameraMatrixState.copy(_cameraMatrixStateTemp);
}