path.js 981 B

1234567891011121314151617181920212223242526272829
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. var PathType;
  4. (function (PathType) {
  5. PathType[PathType["VECTOR"] = 0] = "VECTOR";
  6. PathType[PathType["BEZIER_CURVE"] = 1] = "BEZIER_CURVE";
  7. })(PathType = exports.PathType || (exports.PathType = {}));
  8. exports.equalPath = function (a, b) {
  9. if (a.length === b.length) {
  10. return a.some(function (v, i) { return v === b[i]; });
  11. }
  12. return false;
  13. };
  14. exports.transformPath = function (path, deltaX, deltaY, deltaW, deltaH) {
  15. return path.map(function (point, index) {
  16. switch (index) {
  17. case 0:
  18. return point.add(deltaX, deltaY);
  19. case 1:
  20. return point.add(deltaX + deltaW, deltaY);
  21. case 2:
  22. return point.add(deltaX + deltaW, deltaY + deltaH);
  23. case 3:
  24. return point.add(deltaX, deltaY + deltaH);
  25. }
  26. return point;
  27. });
  28. };
  29. //# sourceMappingURL=path.js.map