From 95831aa89d9f998a3e832bc508f95a76db609b20 Mon Sep 17 00:00:00 2001 From: Matthew Lohbihler Date: Fri, 16 Aug 2024 11:10:56 -0400 Subject: [PATCH 1/6] Fix defaults for skia canvas --- src/types/ellipse.js | 2 ++ src/types/line.js | 4 ++++ src/types/point.js | 2 ++ 3 files changed, 8 insertions(+) diff --git a/src/types/ellipse.js b/src/types/ellipse.js index bddb9511f..f4ed09497 100644 --- a/src/types/ellipse.js +++ b/src/types/ellipse.js @@ -54,8 +54,10 @@ EllipseAnnotation.id = 'ellipseAnnotation'; EllipseAnnotation.defaults = { adjustScaleRange: true, backgroundShadowColor: 'transparent', + borderCapStyle: 'butt', borderDash: [], borderDashOffset: 0, + borderJoinStyle: 'miter', borderShadowColor: 'transparent', borderWidth: 1, display: true, diff --git a/src/types/line.js b/src/types/line.js index ba0aaf874..56d5675a5 100644 --- a/src/types/line.js +++ b/src/types/line.js @@ -107,9 +107,11 @@ LineAnnotation.id = 'lineAnnotation'; const arrowHeadsDefaults = { backgroundColor: undefined, backgroundShadowColor: undefined, + borderCapStyle: 'butt', borderColor: undefined, borderDash: undefined, borderDashOffset: undefined, + borderJoinStyle: 'miter', borderShadowColor: undefined, borderWidth: undefined, display: undefined, @@ -131,8 +133,10 @@ LineAnnotation.defaults = { start: Object.assign({}, arrowHeadsDefaults), width: 6 }, + borderCapStyle: 'butt', borderDash: [], borderDashOffset: 0, + borderJoinStyle: 'miter', borderShadowColor: 'transparent', borderWidth: 2, curve: false, diff --git a/src/types/point.js b/src/types/point.js index 8fd9549d6..9bb5783b7 100644 --- a/src/types/point.js +++ b/src/types/point.js @@ -49,8 +49,10 @@ PointAnnotation.id = 'pointAnnotation'; PointAnnotation.defaults = { adjustScaleRange: true, backgroundShadowColor: 'transparent', + borderCapStyle: 'butt', borderDash: [], borderDashOffset: 0, + borderJoinStyle: 'miter', borderShadowColor: 'transparent', borderWidth: 1, display: true, From b6bfa5edd12fe032237d3583e9407f89340271d8 Mon Sep 17 00:00:00 2001 From: Matthew Lohbihler Date: Fri, 23 Aug 2024 11:20:56 -0400 Subject: [PATCH 2/6] workflow dispatch --- .github/workflows/ci.yml | 78 ++++++++++++++++++++-------------------- 1 file changed, 39 insertions(+), 39 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a4492adc4..a97839e90 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,13 +2,13 @@ name: Node.js CI on: push: - branches: [ master, v2 ] + branches: [master, v2] pull_request: - branches: [ master, v2 ] + branches: [master, v2] + workflow_dispatch: jobs: build: - runs-on: ${{ matrix.os }} strategy: @@ -17,44 +17,44 @@ jobs: fail-fast: false steps: - - uses: actions/checkout@v3 - - name: Use Node.js - uses: actions/setup-node@v3 - with: - cache: npm - node-version: 16 - - run: | - npm ci - npm run build - if [ "${{ runner.os }}" == "Windows" ]; then - npm run lint - else - xvfb-run --auto-servernum npm test - fi - shell: bash - - name: Coveralls Parallel - Chrome - if: runner.os != 'Windows' - uses: coverallsapp/github-action@master - with: - github-token: ${{ secrets.github_token }} - path-to-lcov: './coverage/chrome/lcov.info' - flag-name: ${{ matrix.os }}-chrome - parallel: true - - name: Coveralls Parallel - Firefox - if: runner.os != 'Windows' - uses: coverallsapp/github-action@master - with: - github-token: ${{ secrets.github_token }} - path-to-lcov: './coverage/firefox/lcov.info' - flag-name: ${{ matrix.os }}-firefox - parallel: true + - uses: actions/checkout@v3 + - name: Use Node.js + uses: actions/setup-node@v3 + with: + cache: npm + node-version: 16 + - run: | + npm ci + npm run build + if [ "${{ runner.os }}" == "Windows" ]; then + npm run lint + else + xvfb-run --auto-servernum npm test + fi + shell: bash + - name: Coveralls Parallel - Chrome + if: runner.os != 'Windows' + uses: coverallsapp/github-action@master + with: + github-token: ${{ secrets.github_token }} + path-to-lcov: "./coverage/chrome/lcov.info" + flag-name: ${{ matrix.os }}-chrome + parallel: true + - name: Coveralls Parallel - Firefox + if: runner.os != 'Windows' + uses: coverallsapp/github-action@master + with: + github-token: ${{ secrets.github_token }} + path-to-lcov: "./coverage/firefox/lcov.info" + flag-name: ${{ matrix.os }}-firefox + parallel: true finish: needs: build runs-on: ubuntu-latest steps: - - name: Coveralls Finished - uses: coverallsapp/github-action@master - with: - github-token: ${{ secrets.github_token }} - parallel-finished: true + - name: Coveralls Finished + uses: coverallsapp/github-action@master + with: + github-token: ${{ secrets.github_token }} + parallel-finished: true From 564277eccf5880a38785f1adcee9abb8b458fd9e Mon Sep 17 00:00:00 2001 From: Matthew Lohbihler Date: Fri, 23 Aug 2024 14:54:15 -0400 Subject: [PATCH 3/6] Include properties in arrowhead defaults, but leave undefined --- src/types/line.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/types/line.js b/src/types/line.js index 56d5675a5..2bcaab5c6 100644 --- a/src/types/line.js +++ b/src/types/line.js @@ -107,11 +107,11 @@ LineAnnotation.id = 'lineAnnotation'; const arrowHeadsDefaults = { backgroundColor: undefined, backgroundShadowColor: undefined, - borderCapStyle: 'butt', + borderCapStyle: undefined, borderColor: undefined, borderDash: undefined, borderDashOffset: undefined, - borderJoinStyle: 'miter', + borderJoinStyle: undefined, borderShadowColor: undefined, borderWidth: undefined, display: undefined, From 090bd364208e5e7a27402f9db10b067e250d3706 Mon Sep 17 00:00:00 2001 From: Matthew Lohbihler Date: Thu, 19 Sep 2024 10:07:17 -0400 Subject: [PATCH 4/6] Undo auto-formatting --- .github/workflows/ci.yml | 78 ++++++++++++++++++++-------------------- 1 file changed, 39 insertions(+), 39 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a97839e90..a4492adc4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,13 +2,13 @@ name: Node.js CI on: push: - branches: [master, v2] + branches: [ master, v2 ] pull_request: - branches: [master, v2] - workflow_dispatch: + branches: [ master, v2 ] jobs: build: + runs-on: ${{ matrix.os }} strategy: @@ -17,44 +17,44 @@ jobs: fail-fast: false steps: - - uses: actions/checkout@v3 - - name: Use Node.js - uses: actions/setup-node@v3 - with: - cache: npm - node-version: 16 - - run: | - npm ci - npm run build - if [ "${{ runner.os }}" == "Windows" ]; then - npm run lint - else - xvfb-run --auto-servernum npm test - fi - shell: bash - - name: Coveralls Parallel - Chrome - if: runner.os != 'Windows' - uses: coverallsapp/github-action@master - with: - github-token: ${{ secrets.github_token }} - path-to-lcov: "./coverage/chrome/lcov.info" - flag-name: ${{ matrix.os }}-chrome - parallel: true - - name: Coveralls Parallel - Firefox - if: runner.os != 'Windows' - uses: coverallsapp/github-action@master - with: - github-token: ${{ secrets.github_token }} - path-to-lcov: "./coverage/firefox/lcov.info" - flag-name: ${{ matrix.os }}-firefox - parallel: true + - uses: actions/checkout@v3 + - name: Use Node.js + uses: actions/setup-node@v3 + with: + cache: npm + node-version: 16 + - run: | + npm ci + npm run build + if [ "${{ runner.os }}" == "Windows" ]; then + npm run lint + else + xvfb-run --auto-servernum npm test + fi + shell: bash + - name: Coveralls Parallel - Chrome + if: runner.os != 'Windows' + uses: coverallsapp/github-action@master + with: + github-token: ${{ secrets.github_token }} + path-to-lcov: './coverage/chrome/lcov.info' + flag-name: ${{ matrix.os }}-chrome + parallel: true + - name: Coveralls Parallel - Firefox + if: runner.os != 'Windows' + uses: coverallsapp/github-action@master + with: + github-token: ${{ secrets.github_token }} + path-to-lcov: './coverage/firefox/lcov.info' + flag-name: ${{ matrix.os }}-firefox + parallel: true finish: needs: build runs-on: ubuntu-latest steps: - - name: Coveralls Finished - uses: coverallsapp/github-action@master - with: - github-token: ${{ secrets.github_token }} - parallel-finished: true + - name: Coveralls Finished + uses: coverallsapp/github-action@master + with: + github-token: ${{ secrets.github_token }} + parallel-finished: true From 0bce23d13a8db9aa9c58a80e5fc2929b4dfbab71 Mon Sep 17 00:00:00 2001 From: Matthew Lohbihler Date: Tue, 24 Sep 2024 10:58:17 -0400 Subject: [PATCH 5/6] Replace changes with single helper change --- src/helpers/helpers.canvas.js | 4 ++-- src/types/ellipse.js | 2 -- src/types/line.js | 2 -- src/types/point.js | 2 -- 4 files changed, 2 insertions(+), 8 deletions(-) diff --git a/src/helpers/helpers.canvas.js b/src/helpers/helpers.canvas.js index 436902b8b..dd867f58a 100644 --- a/src/helpers/helpers.canvas.js +++ b/src/helpers/helpers.canvas.js @@ -49,10 +49,10 @@ export function translate(ctx, {x, y}, rotation) { */ export function setBorderStyle(ctx, options) { if (options && options.borderWidth) { - ctx.lineCap = options.borderCapStyle; + ctx.lineCap = options.borderCapStyle || 'butt'; ctx.setLineDash(options.borderDash); ctx.lineDashOffset = options.borderDashOffset; - ctx.lineJoin = options.borderJoinStyle; + ctx.lineJoin = options.borderJoinStyle || 'miter'; ctx.lineWidth = options.borderWidth; ctx.strokeStyle = options.borderColor; return true; diff --git a/src/types/ellipse.js b/src/types/ellipse.js index b34608377..211d0e512 100644 --- a/src/types/ellipse.js +++ b/src/types/ellipse.js @@ -53,10 +53,8 @@ EllipseAnnotation.id = 'ellipseAnnotation'; EllipseAnnotation.defaults = { adjustScaleRange: true, backgroundShadowColor: 'transparent', - borderCapStyle: 'butt', borderDash: [], borderDashOffset: 0, - borderJoinStyle: 'miter', borderShadowColor: 'transparent', borderWidth: 1, display: true, diff --git a/src/types/line.js b/src/types/line.js index 98063fff0..3bbf548ec 100644 --- a/src/types/line.js +++ b/src/types/line.js @@ -134,10 +134,8 @@ LineAnnotation.defaults = { start: Object.assign({}, arrowHeadsDefaults), width: 6 }, - borderCapStyle: 'butt', borderDash: [], borderDashOffset: 0, - borderJoinStyle: 'miter', borderShadowColor: 'transparent', borderWidth: 2, curve: false, diff --git a/src/types/point.js b/src/types/point.js index c989e187b..615051bec 100644 --- a/src/types/point.js +++ b/src/types/point.js @@ -48,10 +48,8 @@ PointAnnotation.id = 'pointAnnotation'; PointAnnotation.defaults = { adjustScaleRange: true, backgroundShadowColor: 'transparent', - borderCapStyle: 'butt', borderDash: [], borderDashOffset: 0, - borderJoinStyle: 'miter', borderShadowColor: 'transparent', borderWidth: 1, display: true, From 595132ffc3355cecfe8138ee75760993e2a139bf Mon Sep 17 00:00:00 2001 From: Matthew Lohbihler Date: Tue, 24 Sep 2024 11:01:40 -0400 Subject: [PATCH 6/6] Remove undefined settings too --- src/types/line.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/types/line.js b/src/types/line.js index 3bbf548ec..dcf5715d3 100644 --- a/src/types/line.js +++ b/src/types/line.js @@ -108,11 +108,9 @@ LineAnnotation.id = 'lineAnnotation'; const arrowHeadsDefaults = { backgroundColor: undefined, backgroundShadowColor: undefined, - borderCapStyle: undefined, borderColor: undefined, borderDash: undefined, borderDashOffset: undefined, - borderJoinStyle: undefined, borderShadowColor: undefined, borderWidth: undefined, display: undefined,