From cf3faa5b4229cdfdb14043f6672c95cca97a83a6 Mon Sep 17 00:00:00 2001 From: Martin Beierling-Mutz Date: Mon, 8 Nov 2021 02:08:45 +0100 Subject: [PATCH 1/4] Create npm-publish.yml --- .github/workflows/npm-publish.yml | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 .github/workflows/npm-publish.yml diff --git a/.github/workflows/npm-publish.yml b/.github/workflows/npm-publish.yml new file mode 100644 index 0000000..6848abe --- /dev/null +++ b/.github/workflows/npm-publish.yml @@ -0,0 +1,27 @@ +# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created +# For more information see: https://help.github.com/actions/language-and-framework-guides/publishing-nodejs-packages + +name: Node.js Package + +on: + push: + # Sequence of patterns matched against refs/heads + branches: + # Push events on main branch + - master + +jobs: + publish-npm: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + # Setup .npmrc file to publish to npm + - uses: actions/setup-node@v2 + with: + node-version: '12.x' + registry-url: 'https://registry.npmjs.org' + - run: npm install + - run: npm publish + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + From 9ac1f668d6564558d6fd2f058c0f3ebe0d640f01 Mon Sep 17 00:00:00 2001 From: Martin Beierling-Mutz Date: Mon, 8 Nov 2021 02:49:44 +0100 Subject: [PATCH 2/4] Remove travis.yml as we now use gh-actions --- .travis.yml | 23 ----------------------- 1 file changed, 23 deletions(-) delete mode 100644 .travis.yml 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 From 6995a015067a72ae8634561dc8d441a684411da1 Mon Sep 17 00:00:00 2001 From: Martin Beierling-Mutz Date: Mon, 8 Nov 2021 10:36:51 +0100 Subject: [PATCH 3/4] Regression hotfix --- src/index.js | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) 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(); } From df7c5ae566e841fb3f5d978fedba334b7504738c Mon Sep 17 00:00:00 2001 From: Martin Beierling-Mutz Date: Mon, 8 Nov 2021 10:38:51 +0100 Subject: [PATCH 4/4] Bump version & update CHANGELOG --- CHANGELOG.md | 6 ++++++ package.json | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) 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",