diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 1d9c616..0000000 --- a/.travis.yml +++ /dev/null @@ -1,23 +0,0 @@ -language: node_js -node_js: -- 8 -before_install: -- npm install codecov coveralls -- npm install nwb -after_success: -- cat ./coverage/lcov.info | ./node_modules/.bin/codecov --pipe -- cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js -branches: - only: - - master -script: - - yarn test - - yarn build -deploy: - skip_cleanup: true - provider: npm - email: mbeierling@gmail.com - api_key: - secure: ZX8j5xi2vhnsWm5BQeLpu9XZ3lwiVK7WH671BhanpwTdHqv1EQdXWXnU5f0qVEL0vNIpqFvSF7fyPby+rtZ36bl8bpvlx8Tqm8iKDI3PuRdp0kt5a3HdaFSedKQE/vx10CRRARs/jAYtv7wW+vVVK6HXE8tvW+OaNFxfsH27lLJvYZbxWSHtnw4cPrZG/U1A8axmkz9q7Yb/U0c50qnRPtU/SK1NlOuVJSaGvHh0KCu2Sv2Vey1J5CTZKrg98Z2viklo3e+5R3UxbTUJz78J4FXs4kabeLAFzNhf2OhD+vyH7xtnJyW5Jt3eT8yMWz40OJQNk5hWOzh1Lucgremyq29/lZtj0fmYwRGRAKpM1HEffCW4TPp+NKlsbkEz6HhbeshSgoGnDetPceIg5AiO3R4bqTpgxj1fcPmuymLne+25RIqF25dcVtrczwu9HmLyr9mGgZMBl5I8MlKTh1IwchT4kTSCMkvNKswxspzve0ncjYTss32zpvPC50cfzXcCNTY3LO0pg5JUPxGVZ7igrCcNmdHHFcXQ15wLM1LPd0W/J8nqBumAAQ2ocdCnG4I5aQ/IpbJmlS7sVJBf1lBX+qlBkJQQvGe/d9FEqelMw2I4CmMOOXPuLwqBoOFqmqH/B50JrFItYzEMee+yzl5LAXvnNCxizvas4A19N29Jl98= - on: - branch: master diff --git a/CHANGELOG.md b/CHANGELOG.md index 52a75d4..911112b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/package.json b/package.json index f5f2ea8..afd32fa 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/src/index.js b/src/index.js index 69a94a1..bf0c122 100644 --- a/src/index.js +++ b/src/index.js @@ -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([ @@ -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; @@ -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(); }