-
Notifications
You must be signed in to change notification settings - Fork 182
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
resize function override not working #46
Comments
Hi @vh13294 , your code above looks correct to me. What is the error you receive? Can you post the full code so that I can help you debug it? |
`import {Component, OnInit} from '@angular/core'; // import third-party module @component({ ngOnInit() { getGradients() { getNextGradient(gradients: string[], current: string) { floatySpace() {
} |
Hi @vh13294 , sorry about the late reply. Your code looks correct so I'm guessing it's something to do when initiating with angular components and Pts. I'm not familiar with angular, but I'm thinking/guessing you can try to make sure your component template has been initialized before calling Pts -- otherwise Pts won't be able to find and resize the element. What's the error you're getting, and do you get it on init or afterwards? |
I fixed the issue. resize?(size: IPt, evt?: Event): undefined; => resize?(size: IPt, evt?: Event): any; |
Basiclly , what I am trying to acheive is to resize the canvas and re-render when the window is resized! I tried space.autoResize = true; , but not working! Is there is better way to acheive this? |
Thanks for the details. I think I figure out what's wrong. The first parameter Meanwhile, you can see a demo of resizing canvas when window resize here: If you cast the |
Hi @vh13294 , the typescript definitions for This is a working demo for your reference: |
space.add custom resize function causing error?
space.add( {
start: (bound, space) => {
// code for init
},
animate: (time, ftime, space) => {
// code for animation
},
action: (type, x, y, event) => {
// code for interaction
},
resize: (size, event) => {
// code for resize
}
} );
The text was updated successfully, but these errors were encountered: