Flipboard / Flipboard/react-canvas

Support Image sx, sy, etc

Open
#122 1 comment 1 reaction 1 assignee Claimed by @tuxracer View on GitHub
Dominant language
JavaScript
Stars
13.2k
Forks
909
PR merge metrics
No merged PRs in 30d

Description

I would really like the ability to be able to specify all the possible arguments to the [CanvasRenderingContext2D.drawImage()](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/drawImage) function.

I am drawing an image as a background to a canvas, and want to give the user the ability to position the background image in any way they please.

As I look through the source code, it look like a possibility if a user is able to set [`options.focusPoint`](https://github.com/Flipboard/react-canvas/blob/master/lib/CanvasUtils.js#L44) in `CanvasUtils.drawImage`. However, the only place in code that calls `CanvasUtils.drawImage` doesn't even [specify the `options` parameter](https://github.com/Flipboard/react-canvas/blob/04efecc13d8f8708a090c50b603a1105117658de/lib/DrawingUtils.js#L381), so it will always remain undefined no matter what I do.

It would be nice to be able to specify this option and have the options fall through to the `ctx.drawImage()`. Something like

``

or maybe be able to put it in the style attributes

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.