Skip to content
This repository was archived by the owner on Aug 1, 2022. It is now read-only.

Commit 650a636

Browse files
committed
Merge branch 'release/v1.2.1'
2 parents 572959e + df7c5ae commit 650a636

File tree

4 files changed

+17
-33
lines changed

4 files changed

+17
-33
lines changed

.travis.yml

-23
This file was deleted.

CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
## [1.2.1] - 2021-11-08
11+
12+
### Fixed
13+
14+
- Pan & Zoom feature now actually works. 1.2.0 introduced the big refactor by markbiddlecom, but also lots of other PRs that were merged, which caused a regression.
15+
1016
## [1.2.0] - 2021-11-08
1117

1218
### Added

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-canvas-draw",
3-
"version": "1.2.0",
3+
"version": "1.2.1",
44
"description": "A simple yet powerful canvas-drawing component for React.",
55
"main": "lib/index.js",
66
"module": "es/index.js",

src/index.js

+10-9
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ const canvasStyle = {
2222
position: "absolute",
2323
};
2424

25+
// The order of these is important: grid > drawing > temp > interface
2526
const canvasTypes = ["grid", "drawing", "temp", "interface"];
2627

2728
const dimensionsPropTypes = PropTypes.oneOfType([
@@ -426,7 +427,7 @@ export default class CanvasDraw extends PureComponent {
426427
}
427428

428429
canvasTypes
429-
.map(({ name }) => this.ctx[name])
430+
.map((name) => this.ctx[name])
430431
.forEach((ctx) => {
431432
this.clearWindow(ctx);
432433
const m = this.coordSystem.transformMatrix;
@@ -685,23 +686,23 @@ export default class CanvasDraw extends PureComponent {
685686
ctx.lineWidth = this.props.gridLineWidth;
686687

687688
if (!this.props.hideGridX) {
688-
let countX = 0;
689+
let countX = minx;
689690
const gridSizeX = this.props.gridSizeX;
690-
while (countX < ctx.canvas.width) {
691+
while (countX < maxx) {
691692
countX += gridSizeX;
692-
ctx.moveTo(countX, 0);
693-
ctx.lineTo(countX, ctx.canvas.height);
693+
ctx.moveTo(countX, miny);
694+
ctx.lineTo(countX, maxy);
694695
}
695696
ctx.stroke();
696697
}
697698

698699
if (!this.props.hideGridY) {
699-
let countY = 0;
700+
let countY = miny;
700701
const gridSizeY = this.props.gridSizeY;
701-
while (countY < ctx.canvas.height) {
702+
while (countY < maxy) {
702703
countY += gridSizeY;
703-
ctx.moveTo(0, countY);
704-
ctx.lineTo(ctx.canvas.width, countY);
704+
ctx.moveTo(minx, countY);
705+
ctx.lineTo(maxx, countY);
705706
}
706707
ctx.stroke();
707708
}

0 commit comments

Comments
 (0)