Commit Graph

205 Commits

Author SHA1 Message Date
David Johansson
73bf805483 Made getAbsoluteOpacity work recursively. Also added support for stage opacity (included test). 2012-10-01 00:55:12 +02:00
ericdrowell
759ec116ce fixed up unit serialization tests. cleaned up constructor jsdoc comments. fixed Ellipse setRadius method 2012-09-26 20:28:20 -07:00
ericdrowell
0a8f0ddb74 got really tired of doing node.getParent().remove(node). To remove a node, you now just do node.remove().
I realize that this doesn't follow the JavaScript pattern of
parent.remove(child), and that from an OO perspective, perhaps nodes
shouldn't have the ability to destroy themselves.  But, from a
practical standpoint, it's a heck of a lot more convenient to just use
.remove() when you want to remove something.
2012-09-26 12:50:08 -07:00
ericdrowell
900f02f912 merged pull request #65 and updated manual tests. Also removed dragConstraint and dragBounds as they are now redundant. I may introduce a set of dragBounds helper functions, similar to filters, that provide common functions out of the box, such as Horizontal and Vertical 2012-09-25 21:23:35 -07:00
ericdrowell
2b99a88b7e merge pull request #106 2012-09-25 16:15:00 -07:00
ericdrowell
d4734ba33a created _getFillType utility to help manage fill type objects. You can now dynamically switch between different fill types, including colors, linear gradients, radial gradients, and patterns 2012-09-25 15:57:57 -07:00
ericdrowell
ff926b34af in addition to Collection each() and apply(), I wanted to make it easier to attach event listeners to node collections, so I went with David Johansson's approach for whitelisting on() and off().
The difference now is that the on() and off() methods are dynamically
added to the Collections prototype from Node, which acts as a wrapper
around each()
2012-09-25 13:38:36 -07:00
ericdrowell
d522b9d9d0 now that the attrs engine has been rewritten, we can cleanly hide and show the layer canvas whenever the layer is hidden or shown via instantiation or with setters. Also improved layer hide and show unit test 2012-09-25 12:22:22 -07:00
ericdrowell
74bef1e108 unrecognized selector should return an empty array. also formatted unit tests 2012-09-25 12:12:27 -07:00
ericdrowell
9bfe5f5e52 refactored get() method 2012-09-25 12:06:02 -07:00
David Johansson
869e420099 Corrected Kinetic.Path.getPointOnLine() to work in negative x direction. Including Unit test. 2012-09-25 08:56:15 +02:00
ericdrowell
0353214fb6 first pass at rewriting the setAttrs logic in Node. In order to have a cleaner OO design, the data type logic needs to exist within each respective module, such that the setter methods are the source of truth.
the setAttrs method now simply calls setter methods.  Also added _clone
and _merge utility methods in Type.  The refactor greatly improves
decoupling and will enable much cleaner OO design in the near future.
2012-09-24 20:34:23 -07:00
David Johansson
16c7cd2708 Re-added Kinetic.Collection to _getNodes and a test confirming its necessity. 2012-09-24 22:31:06 +02:00
ericdrowell
a349fa488c fix #96 setting text to integer data types no longer fails 2012-09-23 18:41:05 -07:00
ericdrowell
24e3aa2c03 added isListening and isDraggable aliases for consistency 2012-09-23 16:06:44 -07:00
David Johansson
45d61a0eb6 Corrected behaviour of the collections apply method.
Changed collections each-method to use same syntax as jQuery - function(index, element) and also being able to use 'this' to get the element.
Added test for apply('on',...) since it needs more than one argument.
2012-09-24 00:05:34 +02:00
ericdrowell
9f5d0fe351 created Collection class to handle iterating over arrays returned from get() 2012-09-23 10:53:23 -07:00
ericdrowell
8d6103d1e0 get() now returns a Node.Array array which has node methods. This means that you can do stuff like layer.get('.shape').setX(300) 2012-09-22 21:27:44 -07:00
Eric Rowell
d0a1b2870e when calling layer.hide() or show(), the physical canvas element is hidden and shown rather than clearing and redrawing the layer. This greatly improves hide and show performance for layers 2012-09-18 09:25:16 -07:00
Eric Rowell
0f2cee5499 merged davonium's pull request which enables deep cloning 2012-09-17 23:20:23 -07:00
Eric Rowell
01c2b28a6c it turns out that there was only a problem with moveDown. refactored logic proposed by Adam 2012-09-17 22:49:24 -07:00
David Johansson
580e52689c Deep cloning. Cloning also clones children. Also added unit test to confirm that it's working as expected. 2012-09-02 23:44:00 +02:00
Eric Rowell
1de5bce6e5 multi line text now correctly supports shadows 2012-08-26 18:49:05 -07:00
Eric Rowell
c01c08d557 now removing color key from shapes hash when a shape is removed from the stage 2012-08-26 18:25:51 -07:00
Eric Rowell
79a1029adb fixed getIntersections bug 2012-08-26 11:00:18 -07:00
Eric Rowell
6eda6d2607 decided to split Circle and Ellipse shapes because it was causing too many issues related to the mixed data type of radius, which could be a number or object with x and y properties 2012-08-25 23:56:39 -07:00
Eric Rowell
ddfcab2d55 layer reordering now correctly reorders scene canvases 2012-08-25 22:26:25 -07:00
Eric Rowell
7b4ec5e6c8 changed bufferImage property to imageBuffer 2012-08-21 19:42:29 -07:00
Eric Rowell
9093d9a512 refactored draw, _draw, and _drawChildren methods in such a way that isVisible and getListening logic resides in one place, therefore improving code quality 2012-08-19 20:44:45 -07:00
Eric Rowell
e99312ece2 refactored filtering logic 2012-08-19 13:09:27 -07:00
Eric Rowell
e19dae3402 rewrote intersects method, which now leverages the new getIntersection method. fixed up unit tests. also fixed bug with getIntersection method 2012-08-18 22:42:37 -07:00
Eric Rowell
f944409a1e new hit detection algo works with images that contain transparent pixels. Devs will need to use the createImageBuffer() method to create a higher precision buffer image 2012-08-18 22:02:16 -07:00
Eric Rowell
f53c43d4f7 added drawScene() method which only redraws the scene and not the buffer 2012-08-16 23:22:07 -07:00
Eric Rowell
6a58830df3 draw methods now draw on both the front and back buffer by default, unless a canvas is passed as an argument. continued fixing up unit tests. Image width and height are now synced whenever the image object changes. 2012-08-15 23:13:50 -07:00
Eric Rowell
bae57488cf added support for image hit detection with new color mapping algo 2012-08-14 23:52:53 -07:00
Eric Rowell
02c6c7276f continued prep work for v4.0.0. removed detectionType property because new event engine uses one strategy. added new drawBuffer method so that you can redraw the buffer without redrawing the visible canvas. changed alpha to opacity. 2012-08-13 23:06:29 -07:00
Eric Rowell
468f8ef2d3 checking in first phase of new hit detection algo, which enables high performance event detections even if there are hundreds of thousands of shapes. This is a giant improvement over the previous algo, and is a fairly big architectural change. Since the Animation architecture and API is also changing, I feel that these changes are big enough to warrant a new major version, v4.0.0 2012-08-11 16:22:01 -07:00
Jason Follas
1d6acca8f3 Fixed flaw in Stage.toDataURL where JPEG layers were hiding lower layers due to the use of black instead of transparent. 2012-08-09 22:39:34 -04:00
Eric Rowell
e5d195f9b4 temporarily disabled serialization unit tests 2012-08-09 11:13:20 -07:00
Eric Rowell
b6db65301c rewrote Animation API to improve flexibility. Animations are no longer tied to the stage. You can now instantiate as many individual animations as you like, and manage them however you like 2012-08-04 00:23:56 -07:00
Eric Rowell
9ad9121259 Kinetic.Animation is now a class that can be instantiated to better represent animation objects. Rather than creating new animation objects and destroying them each time an animation is started and restarted, the same animation obect is now reused, which should help with performance 2012-07-31 23:23:00 -07:00
Eric Rowell
d5eee80c0e changed tempNodes array into a hash to improve performance 2012-07-31 21:35:04 -07:00
Eric Rowell
ed8c5ab6b8 changing the font size now correctly updates the text data 2012-07-31 21:13:25 -07:00
Eric Rowell
75b20573cd removed plugins directory because Kinetic will be using a configurator in the near future 2012-07-31 20:36:36 -07:00
Eric Rowell
87182d704c fixed bug with stage.remove(layer). layer canvas context is now correctly removed from the dom 2012-07-28 22:16:29 -07:00
Eric Rowell
e69c7a9ac1 moved Path back to the plugins, and added Geometry utility methods to the Path namespace so that they can be called as a utility methods without instantiating a Path shape 2012-07-28 17:37:24 -07:00
Eric Rowell
4ea094f459 moved path parsing logic to Geometry class 2012-07-28 16:29:37 -07:00
Eric Rowell
9631d6e1bb split up methods from the PathHelper class and moved them to Path and Geometry. Path specific methods went to Path, and general purpose geometric utility methods went to the Geometry utility class. TextPath now inherits methods from Path 2012-07-28 16:08:14 -07:00
Eric Rowell
5b323bea40 merged with jfollas's TextPath updates, fixed remaining unit, manual, and performance tests, and fixed stroking logic 2012-07-28 09:55:21 -07:00
Jason Follas
8d535556d7 Changed namespace for "plugin" shapes to Kinetic.Plugins. *This is a breaking change!*
Fixed unit tests.  Extracted Path parsing logic into PathHelper so that it's not tied to a particular shape.
2012-07-27 22:51:18 -04:00