Skip to content

Commit

Permalink
Merge pull request #21602 from gitstart/addon-measure/disable-in-docs
Browse files Browse the repository at this point in the history
Addon Measure: Deactivate when switching to Docs mode
  • Loading branch information
yannbf authored and shilman committed May 12, 2023
1 parent a4390f9 commit 83d1115
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions code/addons/measure/src/withMeasure.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export const withMeasure = (StoryFn: StoryFunction<Renderer>, context: StoryCont
});
};

if (measureEnabled) {
if (context.viewMode === 'story' && measureEnabled) {
document.addEventListener('pointerover', onPointerOver);
init();
window.addEventListener('resize', onResize);
Expand All @@ -58,7 +58,7 @@ export const withMeasure = (StoryFn: StoryFunction<Renderer>, context: StoryCont
window.removeEventListener('resize', onResize);
destroy();
};
}, [measureEnabled]);
}, [measureEnabled, context.viewMode]);

return StoryFn();
};

0 comments on commit 83d1115

Please sign in to comment.