These are chat archives for pixijs/pixi.js

30th
Jul 2018

Hi,
Is there a way to allow the canvas object to be scrolled beyond content.
Example:
A canvas created with 1000*1000. And Enabled PAN and Zoom on the canvas. Draw a rectangle on the canvas and move the rectangle with mouse to the edge of the boundaries( top,right, bottom, left) it should scroll the the rectangle to the end of the canvas.

Right now my issue is I can drag the rectangle till the browser boundaries. I need to allow the rectangle to drag beyond the content so that I can use the full canvas. I can PAN the canvas to move around the browser.

Thanks

Ivan Popelyshev
@ivanpopelyshev
Jul 30 2018 07:57
look at pixi-viewport, that's one of implementations for it
and look how it works inside, because that's basics of flash/pixi/any other 2d renderer transforms
Rikki Pitt
@rikkipitt
Jul 30 2018 11:20
hey folks, I'm trying to generalise an animation so I can use it on multiple elements found by class name: https://codepen.io/anon/pen/yqpVYa
I'm having trouble scoping the mouseover/out listeners as I'm using a loop... can anyone suggest a way of mitigating this?
cheers!
this thing was rejected from vanilla because there are too many changes and team doesnt have time to review it
but those meshes are better
you can also animate them easily like AnimatedSprite
Mark Knol
@markknol
Jul 30 2018 13:26
is there a convenience method to copy a displayobject transform to another?
I tried container.localTransform.copy(from.localTransform); but that doesnt update x/y
Mark Knol
@markknol
Jul 30 2018 13:55

I now have

private function copyTransform(from:Container, to:Container) {
    to.position.copy(from.position);
    to.scale.copy(from.scale);
    to.rotation = from.rotation;
    to.skew.copy(from.skew);
    to.pivot.copy(from.pivot);
}

which works fine too

Ivan Popelyshev
@ivanpopelyshev
Jul 30 2018 14:31
please dont use "to" variable name
just a hint for the future ;)
i suggest to copy the transform itself
i mean container.transform , look inside
all those things you use are just properties
of course you still need 4 calls of copy and one of rotation= , because there's no flat object in pixi..
or you can use from.transform.setFromMatrix(to.transform.localTransform)
that's actually good idea
it will fill all positions automatically
Mark Knol
@markknol
Jul 30 2018 14:35
thanks for the suggestion!
btw whats wrong with "to"?
Ivan Popelyshev
@ivanpopelyshev
Jul 30 2018 14:37
other languages
its reserved word that hurts eyes when people use it as a variable
Mark Knol
@markknol
Jul 30 2018 14:40
which language for example?
i mean, Haxe has it as keyword but its not reserved
Ivan Popelyshev
@ivanpopelyshev
Jul 30 2018 14:41
pascal :)
"for x:=1 to 10 do"
Mark Knol
@markknol
Jul 30 2018 14:41
haha
Ivan Popelyshev
@ivanpopelyshev
Jul 30 2018 14:41
kotlin
Mark Knol
@markknol
Jul 30 2018 14:41
i swear i will never port to pascal
haha