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

Disable aspect ratio #54

Open
stephanedemotte opened this issue Mar 22, 2019 · 2 comments
Open

Disable aspect ratio #54

stephanedemotte opened this issue Mar 22, 2019 · 2 comments
Labels
enhancement New feature or request

Comments

@stephanedemotte
Copy link

stephanedemotte commented Mar 22, 2019

Hello.

We need to put video into the canvas to take a screenshot via canvas.toDataUrl('png')

For anyone we simply scene.background = new THREE.VideoTexture(source.domElement)

But when we shoot the canvas, the width and height is is the same than what we see.
You use a bigger canvas than the screen, and re-center it with margin-left or margin-top.

Can you add a param to disable the keep aspect ratio ?

Thanks again for this great work !

@stephanedemotte stephanedemotte changed the title Wierd Width / Height Disable aspect ratio Mar 22, 2019
@JamesLMilner JamesLMilner added the enhancement New feature or request label Mar 22, 2019
@JamesLMilner
Copy link
Owner

@stephanedemotte I'm guessing this is to do with the way in which the webcam source sets the objectFit property for its HTMLVideoElement: https://github.com/JamesMilnerUK/THREEAR/blob/master/src/Source.ts#L303

Does that sound right to you? I'm not entirely sure how to provide the parameter you're asking for or how to make it work for your use case so any code samples or deeper explanation would be helpful.

@stephanedemotte
Copy link
Author

stephanedemotte commented Mar 26, 2019

Sorry @JamesMilnerUK my english suck, i will try to be more clear

In https://github.com/JamesMilnerUK/THREEAR/blob/master/src/Source.ts#L201
In the onResizeElement function you make the canvas bigger than the window, then you center with martin-left or margin-top, is it possible to keep the canvas the same size as the window?

@JamesMilnerUK ping!

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

No branches or pull requests

2 participants