flamegraphZoomPosition.tsx 484 B

123456789101112131415161718192021222324
  1. import {Rect} from 'sentry/utils/profiling/gl/utils';
  2. type FlamegraphZoomPositionAction = {
  3. payload: Rect;
  4. type: 'checkpoint';
  5. };
  6. type FlamegraphZoomPosition = {
  7. view: Rect;
  8. };
  9. export function flamegraphZoomPositionReducer(
  10. state: FlamegraphZoomPosition,
  11. action: FlamegraphZoomPositionAction
  12. ): FlamegraphZoomPosition {
  13. switch (action.type) {
  14. case 'checkpoint': {
  15. return {view: Rect.From(action.payload)};
  16. }
  17. default: {
  18. return state;
  19. }
  20. }
  21. }