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

Calling setLayer on a newly created text layer leaves text being undefined #163

Closed
nickw444 opened this issue Sep 1, 2014 · 11 comments
Closed

Comments

@nickw444
Copy link

@nickw444 nickw444 commented Sep 1, 2014

When checking the object before setLayer is called, the property text is set to underfined, although there is text rendered on the screen for this layer.

When setLayer is called, the text is then updated on the canvas to underfined as per the property.

Browser: Chrome Version 36.0.1985.143
OS: OSX Mavericks

@nickw444 nickw444 closed this Sep 1, 2014
@nickw444 nickw444 reopened this Sep 1, 2014
@nickw444
Copy link
Author

@nickw444 nickw444 commented Sep 1, 2014

Workaround:

var layer = $('canvas').getLayer('my_layer');
var text = layer.text;

$('canvas').setLayer('my_layer', {
   x: 100,
   y: 100,
   text: text,
});
$('canvas').drawLayers();
@caleb531
Copy link
Owner

@caleb531 caleb531 commented Sep 1, 2014

Thanks for the report. However, I am unable to reproduce the issue. Could you please provide a complete (ideally simplified) code sample that reproduces the bug?

Thanks,
Caleb

@nickw444 nickw444 closed this Sep 12, 2014
@nickw444
Copy link
Author

@nickw444 nickw444 commented Sep 12, 2014

Unable reproduce, will re-open if this shows up again.

@Nierrrrrrr
Copy link

@Nierrrrrrr Nierrrrrrr commented Sep 26, 2014

Hi, I have a similar problem here.
When I use setLayer to set a text's visible from false to true, it will let the text be "undefined".
I use mouseover to set that text's visible to false and use mouseout to set it to true. After the mouse moving in and out, the text became "undefined".

@caleb531
Copy link
Owner

@caleb531 caleb531 commented Sep 26, 2014

Again, I am asking for a valid code sample that reproduces the issue before I can investigate the issue further.

-Caleb

@Nierrrrrrr
Copy link

@Nierrrrrrr Nierrrrrrr commented Sep 27, 2014

Hello,
I'm sorry that I didn't provide the code sample.
When I trying to reproduces the issue, I found that I works fine in Sandbox of jCanvas website. However, the issue is still there in my personal website.
The website code is here:
http://codepad.org/hdkVopF9
and the result is like:
http://i.imgur.com/rvZ2iDz.png

@caleb531
Copy link
Owner

@caleb531 caleb531 commented Sep 27, 2014

What version of jCanvas are you using?

-Caleb

On Sep 26, 2014, at 7:37 PM, Nierrrrrrr notifications@github.com wrote:

Hello,
I'm sorry that I didn't provide the code sample.
When I trying to reproduces the issue, I found that I works fine in Sandbox of jCanvas website. However, the issue is still there in my personal website.
The website code is here:
http://codepad.org/hdkVopF9
and the result is like:
http://i.imgur.com/rvZ2iDz.png


Reply to this email directly or view it on GitHub.

@Nierrrrrrr
Copy link

@Nierrrrrrr Nierrrrrrr commented Sep 27, 2014

/*
jCanvas v14.09.14
Copyright 2014 Caleb Evans
Released under the MIT license
*/
I just download it 2 days ago.

I make a live demo here:
http://jsfiddle.net/jrttgguL/

And I found that if I using @license jCanvas v14.07.16, no "undefined" issue. It works fine at previous version, which sandbox uses.
Demo here:
http://jsfiddle.net/n5ee0x2d/

@caleb531
Copy link
Owner

@caleb531 caleb531 commented Sep 27, 2014

Thank you, Nierrrrrrr, for reaching out to me regarding this issue—I have confirmed that this is a jCanvas bug. Fortunately, the fix is extremely simple, and the patched build is now available on master as v14.09.27.

Thanks again,
Caleb

@caleb531
Copy link
Owner

@caleb531 caleb531 commented Sep 27, 2014

Okay, after throwing your codepad code into an HTML file and viewing that, I can confirm that this is a jCanvas bug. Good news is, fixing the bug turned out to be extremely simple.

I've just pushed the patched build to GitHub as v14.09.27.

-Caleb

On Sep 27, 2014, at 6:12 AM, Nierrrrrrr notifications@github.com wrote:

/*
jCanvas v14.09.14
Copyright 2014 Caleb Evans
Released under the MIT license
*/
I just download it 2 days ago.


Reply to this email directly or view it on GitHub.

@nickw444
Copy link
Author

@nickw444 nickw444 commented Sep 28, 2014

+1 Thanks Caleb

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

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.