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

[Bug] features not working properly on Two.Texture obj #665

Open
1 of 3 tasks
joex92 opened this issue Sep 29, 2022 · 1 comment
Open
1 of 3 tasks

[Bug] features not working properly on Two.Texture obj #665

joex92 opened this issue Sep 29, 2022 · 1 comment
Labels

Comments

@joex92
Copy link

joex92 commented Sep 29, 2022

Describe the bug
After creating a texture neither the texture.scale, nor the texture.className, nor the texture.image.style features do a thing on the texture...

To Reproduce
Steps to reproduce the behavior:

  1. Create a texture: tex = new two.Texture('[image-url]')
  2. apply it to an object: rect.fill = tex
  3. modify the texture: tex.scale = 0.5
  4. the texture is not changed

Expected behavior
for the texture to change according to either the className or modifying it.

Screenshots
here I scale it to the canvas width and move it to the center:
image
then when I resize the window, the image should resize:
image
but as you can see here, the image seems to be resized but it's not, you can see it tilling when it should be smaller:
image

Environment (please select one):

  • Code executes in browser (e.g: using script tag to load library)
  • Running headless (usually Node.js)
  • Packaged software (e.g: ES6 imports, react, angular, vue.js)

Desktop (please complete the following information):

  • OS: [Windows]
  • Browser [Brave]
  • Version [Version 1.44.101 Chromium: 106.0.5249.65 (Official Build) (64-bit)]

Smartphone (please complete the following information):

  • Device: [Nokia 6.1]
  • OS: [Android 10]
  • Browser [Brave]
  • Version [1.43.93, Chromium 105.0.5195.127]

Additional context
the texture.repeat doesn't work either... it should by default not repeat, but as you can see in the screenshots it repeats...
the image used is from another web page, not loaded locally...
I'm applying the texture to a path.stroke...

@joex92 joex92 added the bug label Sep 29, 2022
@jonobr1
Copy link
Owner

jonobr1 commented Sep 29, 2022

I can confirm that the scale, offset, and repeat values are not respected on the SVG Renderer. However, it looks like it works fine for me in canvas: https://codepen.io/jonobr1/pen/QWrmdMz

Are you using the latest version?

The default values are repeated because of the way SVG works. Two.js aims to create consistencies between different rendering types. That being said, I'm trying to rewrok the Two.Texture class so that it doesn't do the Two.Sprite behavior by default and acts more like an image. See this issue for more details and branch developments: #653

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

No branches or pull requests

2 participants