Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Image Width/Height in 'drawImage' #64

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

afilp
Copy link

@afilp afilp commented Dec 16, 2018

This is needed when the image has different dimension than the wheel radius dictates.

For example, I have 'outerRadius': 100,, which means that the wheel has dimensions 200x200, but I have an image with dimensions 600x600 (I want to keep it like this due to mobile rendering in higher resolution).

So, I do this, and this works:

	// Set the image source, once complete this will trigger the onLoad callback (above).
	loadedImg.src = 'wheelimage.png';
	loadedImg.width = 200;
	loadedImg.height = 200;

But, without my proposed change, the image is not positioned in the canvas correctly.

This PR solves this issue, we can now use any image width/height we like (different than what the wheel dimensions are).

This is needed when the image has different dimension than the wheel radius dictates.

For example, I have `'outerRadius': 100,`, which means that the wheel has dimensions `200x200`, but I have an image with dimensions `600x600` (I want to keep it like this due to mobile rendering in higher resolution).

So, I do this, and this works:
```
	// Set the image source, once complete this will trigger the onLoad callback (above).
	loadedImg.src = 'wheelimage.png';
	loadedImg.width = 200;
	loadedImg.height = 200;
```

But, without my proposed change, the image is not positioned in the canvas correctly.

This PR solves this issue, we can now use any image width/height we like (different than what the wheel dimensions are).
@fogolin
Copy link

fogolin commented Mar 7, 2023

This actually would be great!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants