createCanvasEvent.js 804 B

1234567891011121314151617181920212223242526272829
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.default = createCanvasEvent;
  6. /**
  7. * This function returns a CanvasRenderingContext2DEvent. Whenever an operation would modify the canvas
  8. * context, this function should be used to generate an "event" that represents that sort of modification.
  9. * This will be used to mock for snapshots.
  10. *
  11. * @example
  12. * interface CanvasRenderingContext2DEvent {
  13. * type: string;
  14. * transform: [number, number, number, number, number, number]; // the resulting current transform
  15. * props: {
  16. * // if the event is a property was set, `event.props.value` would be set
  17. * [propName: string]: any;
  18. * };
  19. * }
  20. */
  21. function createCanvasEvent(type, transform, props) {
  22. return {
  23. type,
  24. transform,
  25. props
  26. };
  27. }