angular-signature-pad icon indicating copy to clipboard operation
angular-signature-pad copied to clipboard

canvasWidth and canvasHeight have no effect

Open EugeneQilo opened this issue 1 year ago • 5 comments

It seems like passing or not passing canvasWidth & canvasHeight have no effect... canvas is calculating the size from DOM and in my case, it is calculating wrong (much bigger)...

Here are the options I'm passing... Any idea what could be wrong?

public options: NgSignaturePadOptions = {
    minWidth: 1,
    backgroundColor: 'rgba(255,255,255)',
    canvasHeight: 150,
    canvasWidth: 300,
    canvasBackground: 'rgba(255,255,255)',
} as any;

To reproduce:

  1. In Developer Tools, toggle Device simulation... Select a mobile device... for example iPhone 12 Pro
  2. Render the signature, notice the size... devicePixelRatio = 3 which is leading to wrong calculations

@almothafar

EugeneQilo avatar Jan 06 '25 21:01 EugeneQilo

I see the issue in the demo https://almothafar.github.io/angular-signature-pad/ I'll look into it, but I'm so busy I'm not sure how fast I can resolve this, if you want to make a PR it is more than welcome, otherwise, I need to find some time.

almothafar avatar Jan 13 '25 20:01 almothafar

any help or advice to solve it ?

ebarolo avatar Feb 03 '25 17:02 ebarolo

@almothafar

Hello! i would like to know if you are going to optimize angular-signature-pad for angular 19?

khmax7 avatar Feb 25 '25 15:02 khmax7

Same here, I believe its a regression since updating angular, did you find any solution? @EugeneQilo

tigrenok00 avatar Aug 25 '25 08:08 tigrenok00

@tigrenok00 since @almothafar is not replying, I forked it and bypassed the function (redrawCanvas) causing the issue... see here.

I would not recommend using my repo for your code, you can consider creating a PR with the fix into this repo..

EugeneQilo avatar Aug 25 '25 15:08 EugeneQilo

I pushed a possible fix 6.0.1.

Sorry for being late, I don't work in any Angular these days.

almothafar avatar Nov 30 '25 17:11 almothafar