copy.mjs 767 B

12345678910111213141516171819202122232425262728293031
  1. /**
  2. * Reset an axis to the provided origin box.
  3. *
  4. * This is a mutative operation.
  5. */
  6. function copyAxisInto(axis, originAxis) {
  7. axis.min = originAxis.min;
  8. axis.max = originAxis.max;
  9. }
  10. /**
  11. * Reset a box to the provided origin box.
  12. *
  13. * This is a mutative operation.
  14. */
  15. function copyBoxInto(box, originBox) {
  16. copyAxisInto(box.x, originBox.x);
  17. copyAxisInto(box.y, originBox.y);
  18. }
  19. /**
  20. * Reset a delta to the provided origin box.
  21. *
  22. * This is a mutative operation.
  23. */
  24. function copyAxisDeltaInto(delta, originDelta) {
  25. delta.translate = originDelta.translate;
  26. delta.scale = originDelta.scale;
  27. delta.originPoint = originDelta.originPoint;
  28. delta.origin = originDelta.origin;
  29. }
  30. export { copyAxisDeltaInto, copyAxisInto, copyBoxInto };