Skip to content

Commit 506410d

Browse files
committed
invalidate ctx style cache on plot resize. close #570.
1 parent 2c04d67 commit 506410d

File tree

5 files changed

+17
-1
lines changed

5 files changed

+17
-1
lines changed

dist/uPlot.cjs.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3814,6 +3814,10 @@ function uPlot(opts, data, then) {
38143814
can.width = round(fullWidCss * pxRatio);
38153815
can.height = round(fullHgtCss * pxRatio);
38163816

3817+
// invalidate ctx style cache
3818+
ctxStroke = ctxFill = ctxWidth = ctxJoin = ctxCap = ctxFont = ctxAlign = ctxBaseline = ctxDash = null;
3819+
ctxAlpha = 1;
3820+
38173821
syncRect(false);
38183822

38193823
fire("setSize");

dist/uPlot.esm.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3812,6 +3812,10 @@ function uPlot(opts, data, then) {
38123812
can.width = round(fullWidCss * pxRatio);
38133813
can.height = round(fullHgtCss * pxRatio);
38143814

3815+
// invalidate ctx style cache
3816+
ctxStroke = ctxFill = ctxWidth = ctxJoin = ctxCap = ctxFont = ctxAlign = ctxBaseline = ctxDash = null;
3817+
ctxAlpha = 1;
3818+
38153819
syncRect(false);
38163820

38173821
fire("setSize");

dist/uPlot.iife.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3815,6 +3815,10 @@ var uPlot = (function () {
38153815
can.width = round(fullWidCss * pxRatio);
38163816
can.height = round(fullHgtCss * pxRatio);
38173817

3818+
// invalidate ctx style cache
3819+
ctxStroke = ctxFill = ctxWidth = ctxJoin = ctxCap = ctxFont = ctxAlign = ctxBaseline = ctxDash = null;
3820+
ctxAlpha = 1;
3821+
38183822
syncRect(false);
38193823

38203824
fire("setSize");

dist/uPlot.iife.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/uPlot.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1797,6 +1797,10 @@ export default function uPlot(opts, data, then) {
17971797
can.width = round(fullWidCss * pxRatio);
17981798
can.height = round(fullHgtCss * pxRatio);
17991799

1800+
// invalidate ctx style cache
1801+
ctxStroke = ctxFill = ctxWidth = ctxJoin = ctxCap = ctxFont = ctxAlign = ctxBaseline = ctxDash = null;
1802+
ctxAlpha = 1;
1803+
18001804
syncRect(false);
18011805

18021806
fire("setSize");

0 commit comments

Comments
 (0)