ehoefig / KineticGWT

A GWT wrapper for kinetic.js
11 stars 2 forks source link

upgrade to latest kineticjs #18

Open Dawied opened 11 years ago

Dawied commented 11 years ago

I started using kineticjs 4.2.0 with KineticGWT a while ago. Until now I had to change the following:

  1. The parameters in createAnimation in Kinetic.java have changed in 4.2.0, it now uses 2 parameters instead of an object:

    /**
    * Create an Animation.
    * @param context The context layer (animation takes place on this layer)
    * @param fct A custom drawing function
    * @return An object that can be used to control the animation
    */
    public static native Animation createAnimation(Layer context, Drawable fct) /*-{
       return new $wnd.Kinetic.Animation(
        function(frame) {
           fct.@net.edzard.kinetic.Drawable::draw(Lnet/edzard/kinetic/Frame;)(@net.edzard.kinetic.Frame::new(DDD)(frame.lastTime, frame.time, frame.timeDiff));
         },
         context
       );
    }-*/;
  2. getBoxHeight and getBoxWidth in Text class do not exist anymore in kineticjs, the getWidth and getHeight now return the box size.
letmaik commented 11 years ago

Thanks for those first two bits. Upgrading to a new KineticJS version though is probably better done in a single rush by going through the changelog (in our case from 4.0.2 to 4.2.0, or rather 4.3.0) and adapting everything at once.

ehoefig commented 11 years ago

Yup, I agree. Let's do an upgrade to the latest version for the v1.0.0 milestone.

ArtemGr commented 11 years ago

I think there's no remove(child) in Kinetic.Container anymore, instead one has to call the Node.remove() or Node.destroy()

ArtemGr commented 11 years ago

In KineticGWT all Nodes are draggable by default. In the newest KineticJS (4.3.1) this leads to undesired behaviour: instead of moving the Container (e.g. Group), KineticJS moves the Node inside the Group. I suggest switching the default to false as it is more in line with the KineticJS and it is easier to turn draggability "on" on the container than to turn it "off" on all the constituents of the container.