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

Commit

Permalink
Merge branch 'release/v1.2.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
embiem committed Nov 8, 2021
2 parents 572959e + df7c5ae commit 650a636
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 33 deletions.
23 changes: 0 additions & 23 deletions .travis.yml

This file was deleted.

6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [1.2.1] - 2021-11-08

### Fixed

- 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.

## [1.2.0] - 2021-11-08

### Added
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-canvas-draw",
"version": "1.2.0",
"version": "1.2.1",
"description": "A simple yet powerful canvas-drawing component for React.",
"main": "lib/index.js",
"module": "es/index.js",
Expand Down
19 changes: 10 additions & 9 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ const canvasStyle = {
position: "absolute",
};

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

const dimensionsPropTypes = PropTypes.oneOfType([
Expand Down Expand Up @@ -426,7 +427,7 @@ export default class CanvasDraw extends PureComponent {
}

canvasTypes
.map(({ name }) => this.ctx[name])
.map((name) => this.ctx[name])
.forEach((ctx) => {
this.clearWindow(ctx);
const m = this.coordSystem.transformMatrix;
Expand Down Expand Up @@ -685,23 +686,23 @@ export default class CanvasDraw extends PureComponent {
ctx.lineWidth = this.props.gridLineWidth;

if (!this.props.hideGridX) {
let countX = 0;
let countX = minx;
const gridSizeX = this.props.gridSizeX;
while (countX < ctx.canvas.width) {
while (countX < maxx) {
countX += gridSizeX;
ctx.moveTo(countX, 0);
ctx.lineTo(countX, ctx.canvas.height);
ctx.moveTo(countX, miny);
ctx.lineTo(countX, maxy);
}
ctx.stroke();
}

if (!this.props.hideGridY) {
let countY = 0;
let countY = miny;
const gridSizeY = this.props.gridSizeY;
while (countY < ctx.canvas.height) {
while (countY < maxy) {
countY += gridSizeY;
ctx.moveTo(0, countY);
ctx.lineTo(ctx.canvas.width, countY);
ctx.moveTo(minx, countY);
ctx.lineTo(maxx, countY);
}
ctx.stroke();
}
Expand Down

0 comments on commit 650a636

Please sign in to comment.