-
Notifications
You must be signed in to change notification settings - Fork 193
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
Not able to retrieve a function layer by name using v5.4 #18
Comments
I recently changed the v5.4b code to fix a bug. To ensure layers can be Frankly, I don't see any real need to override the context. At this point, -Caleb On Sat, Jun 9, 2012 at 7:50 AM, BillyRayPreachersSon <
|
Just wanted to let you know: I added the ability to name function layers in v5.4. You can do so simply by naming the function expression you pass to it. For example, $("canvas").addLayer(function myLayerName() { For more flexibility, you can also pass an object instead, with the function as the object's 'fn' property: $("canvas").addLayer({ I hope that helps. |
Great - thanks :-) |
Hi,
I've just tested some of my code against v5.4, and found that it's no longer possible to retrieve a function layer by its name as you can with non-function layers. This is possible with v5.3.1.
Take the following scenario:
Under v5.3.1, here's what I got:
Under v5.4, here's what I get:
While on the subject of function layers, would it be possible to add a facility to provide a context for "this" when adding the layer? At present, "this" refers to the canvas - which is fine in some cases. However, it would be nice to be able to override this without having to restort to code like this:
The reason for the named local function in the call to this.canvas.addLayer() is because $.proxy doesn't keep the function name. I could probably use .call() or .apply() here, but I think it would make code flow much easier if the context could be set when the layer was added.
Thanks!
Dan
The text was updated successfully, but these errors were encountered: