Giter Club home page Giter Club logo

Comments (1)

caleb531 avatar caleb531 commented on June 23, 2024

Wow, how did I miss that? :/

Anyway, it's fixed now. The fixed build should already be on GitHub.

-Caleb

On Sat, Jun 9, 2012 at 7:56 AM, BillyRayPreachersSon <
[email protected]

wrote:

It seems that when using v5.4, you can'tt chain calls to removeLayer.
Here's my test code from Issue #18:

var MyObj = {
       canvas: $('<canvas />'),

       addLayer: function() {
               this.canvas.addLayer(this.drawLines);
       },

       drawLines: function lines(ctx) {
               console.log('MyObj.drawLines is being called');
               console.log('"this" context = ', this);
       }
}

Here's what I see when using v5.3.1:

MyObj.canvas.addLayer({ method:'drawRect', name:'myBox', fillStyle:'#585',
x:100, y:100, width:100, height:50 });
MyObj.canvas.addLayer({ method:'drawRect', name:'myBox2',
fillStyle:'#585', x:100, y:100, width:100, height:50 });
MyObj.canvas.getLayers().length;
             // 2
MyObj.canvas.getLayer('myBox');
              // Object
MyObj.canvas.getLayer('myBox2');
             // Object
MyObj.canvas.removeLayer('myBox').removeLayer('myBox2');        //
[<canvas>​]
MyObj.canvas.getLayers().length;
             // 0

And with v5.4:

MyObj.canvas.addLayer({ method:'drawRect', name:'myBox', fillStyle:'#585',
x:100, y:100, width:100, height:50 });
MyObj.canvas.addLayer({ method:'drawRect', name:'myBox2',
fillStyle:'#585', x:100, y:100, width:100, height:50 });
MyObj.canvas.getLayers().length;
             // 2
MyObj.canvas.getLayer('myBox');
              // E
MyObj.canvas.getLayer('myBox2');
             // E
MyObj.canvas.removeLayer('myBox').removeLayer('myBox2');        //
TypeError: Cannot call method 'removeLayer' of undefined

I'd initially thought it was failing as no layer existed with the name I
was trying to remove - but it happens when removing layers that are present
as well.

Dan


Reply to this email directly or view it on GitHub:
#19

from jcanvas.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.