Commit Graph

378 Commits

Author SHA1 Message Date
Eric Rowell
3fb9576672 each animation now has its own frame object. This fixes issues that were seen when using multiple animations simultaneously 2012-12-11 22:34:58 -08:00
Eric Rowell
16f81f6204 fixed up stage toImage() translation problem 2012-12-11 00:21:43 -08:00
Eric Rowell
cb8d36c393 fixed several bugs with toImage(). toImage() can now also accept x and y params. added extensive caching unit test. removed drawBuffer logic as it is no longer needed 2012-12-11 00:08:59 -08:00
Eric Rowell
9b7f0ea8ff updated .gitignore and added more performance tests around image cropping and scaling in order to understand the value of a SpriteSheet plugin 2012-12-09 20:13:17 -08:00
Eric Rowell
291583148b moved all rendering logic into the Canvas renderer modules. Shape draw funcs are now passed a renderer object, not a canvas context. The context is accessible via canvas.getContext() 2012-12-09 09:52:33 -08:00
Eric Rowell
c316edb418 added transform property normalization in setFill() method and also added fill transform unit tests 2012-12-08 09:26:16 -08:00
Eric Rowell
01c5f4f7ca fill patterns can now be translated, rotated, scaled, and offset like nodes 2012-12-07 23:25:33 -08:00
Eric Rowell
5705d909e5 changed test to warn for node and shape selector unit test, and added more info in the README Testing section 2012-12-03 19:54:58 -08:00
Eric Rowell
ab19b442a0 wrapped all modules with anonymous func. moved Canvas to root dir because it's now coupled to KineticJS logic. removed whitelisting arrays from Global. Did some prep work for AMD and Node support 2012-12-01 12:04:10 -08:00
Eric Rowell
8e5297033b optimized line shape drawing logic, and also added image cropping performance tests 2012-11-30 21:59:48 -08:00
Eric Rowell
8a195618cf cleaned up some cropping logic in Image, and added a cropping unit test 2012-11-30 20:01:10 -08:00
Eric Rowell
047e26382e added new wedge shape. cleaned up shape comments. added degToRad and radToDeg helper in Type utility 2012-11-29 20:15:01 -08:00
Eric Rowell
44e454d740 changed other instances of imageBuffer to imageHitRegion 2012-11-28 23:28:24 -08:00
Eric Rowell
94670aeeda changed createImageBuffer to createImageHitRegion for consistency 2012-11-28 23:18:17 -08:00
Eric Rowell
6ae7a932f8 updated test framework CSS 2012-11-28 23:04:23 -08:00
Eric Rowell
424e86bd2b added warning check for toDataURL, and also improved image buffer unit tests 2012-11-28 22:19:49 -08:00
Eric Rowell
8958fbffc6 new applyShadow method for shape. Images with transparent pixels can now have shadows applied to them again. Fixed image stroke buffer rendering issue 2012-11-28 20:50:33 -08:00
Eric Rowell
e6eb647462 fix #164 prepend # to colorKey so that events work again in non webit browsers 2012-11-27 19:43:33 -08:00
Eric Rowell
48e014fe01 bug fix #29 bug fix #143 when node.remove() is called, parent property is unset. Also migrated remove tests from containerTests to nodeTests. 2012-11-24 23:19:16 -08:00
Eric Rowell
60db1a2d43 cleaned up functional test data urls. Functional tests now pass with no warnings 2012-11-24 23:00:14 -08:00
Eric Rowell
94c3c913cb cleaned up unit test data urls. All unit tests now pass with no warnings 2012-11-24 22:48:23 -08:00
Eric Rowell
0e6eb3ffe4 fixed up some text shadow issues 2012-11-24 09:15:02 -08:00
Eric Rowell
0e514f7810 fixed up text path draw func 2012-11-24 00:05:37 -08:00
Eric Rowell
7f68dafb5c fixed up Image hit draw func 2012-11-23 23:55:20 -08:00
Eric Rowell
318d03feb7 finished up new Scene and Hit Renderers. added new textShadow attrs for more flexibility. Added new fillStroke() method which encapsulates shadow application logic 2012-11-23 14:54:32 -08:00
Eric Rowell
144e95ad42 preparation work for new Renderer inheritance pattern 2012-11-20 23:03:24 -08:00
Eric Rowell
27d5031665 further decoupled scene, hit, and buffer graph drawing. To define a custom hit draw function, you now need to set the drawHitFunc attr. 2012-11-18 19:50:50 -08:00
Eric Rowell
e04b979063 improved drag and drop performance by skipping buffer redraws on drag move 2012-11-17 22:29:07 -08:00
Eric Rowell
feb1c83aac added unit test for group to image 2012-11-15 22:22:38 -08:00
Eric Rowell
383a039def applyFilter() method now takes in a required filter function, and an optional config and callback function, rather than a config object 2012-11-15 21:51:33 -08:00
Eric Rowell
0db40018af prepend tests with a ! to omit a particular test from the test suite 2012-11-15 21:33:39 -08:00
Eric Rowell
1913fed33b Kinetic.Animation constructor now just requires a function and optional node. No more config object 2012-11-15 21:30:58 -08:00
Eric Rowell
694ced6b7a added custom buffer drawing function functional tests. Added an index page with links to all of the KineticJS tests inside the tests directory 2012-11-14 22:14:15 -08:00
Eric Rowell
9f80402dd1 improved functional test layout, and started work on drawBufferFunc support 2012-11-14 21:55:16 -08:00
Eric Rowell
914ee2fb4b after doing some more performance testing, decided to remove class level cache in favor of local method variable caching only 2012-11-13 23:48:30 -08:00
Eric Rowell
2115920ab8 fixed up Canvas type bug. The Canvas constructor can now also take an optional isBuffer param. If not defined, default value is scene 2012-11-13 22:16:36 -08:00
Eric Rowell
178c4d7d42 removing unitTests.js from project because it is no longer a source file 2012-11-13 21:42:02 -08:00
Eric Rowell
a5e23c426d restructured unit tests and created a unit test build target which concatenates source test files 2012-11-13 21:37:28 -08:00
Eric Rowell
5be1802729 fix #149 began decoupling scene graph draw and buffer graph draw logic. This will enable more flexibility for developers to define custom buffer draw functions, and it also improves draw performance for both the scene and buffer graphs, because each function can be optimized for its purpose. Also moved text drawing logic to the Text shape 2012-11-12 19:59:19 -08:00
Eric Rowell
356c302ac3 added shapeType property to Sprite which fixes a bug related to cloning Sprites. Also added more unit tests 2012-11-04 18:15:29 -08:00
Eric Rowell
656a7a63e4 added Invert filter which inverts image colors 2012-11-04 11:30:40 -08:00
Eric Rowell
b76cc09742 added Brighten filter 2012-11-04 10:52:33 -08:00
Eric Rowell
921d9f0caa improved unit test for setDrawFunc() 2012-11-04 08:54:32 -08:00
Eric Rowell
b3e7e26248 console.warn() was failing in IE9 running on Windows7 64bit. changed check to window.console 2012-11-04 08:07:09 -08:00
Eric Rowell
32e72176ca isListening() method now takes into account ancestor listening 2012-11-03 22:20:46 -07:00
Eric Rowell
0748692c1d added new fire() method which fires synthetic events and custom events. Simulate() now simulates user events with event bubbling 2012-11-03 17:19:21 -07:00
Eric Rowell
78668b0d38 greatly improved animation, transition, and drag and drop performance by dynamically switching between fixed and dynamic frame rates, and also created a single source of truth for the animation frame object 2012-11-03 11:16:33 -07:00
Eric Rowell
fb90709b3a greatly improved transition performance by directly setting attr properties for each frame, and also removing unecessary redraws when transition finishes 2012-10-28 22:41:13 -07:00
Eric Rowell
d636afb6fe text.getWidth() and getHeight() now return calculated width and height. Removed getBoxWidth() and getBoxHeight() methods 2012-10-11 20:00:13 -07:00
Eric Rowell
0ae50ba523 merge trunk 2012-10-10 19:25:50 -07:00
Eric Rowell
2426c2bd2c moved width and height attrs to node level. This enables us to get and set shape dimensions via width and height. For example, if you have a circle with radius 50, getWidth() will return 100. Not all shapes width and height methods have been implemented yet 2012-10-10 18:48:08 -07:00
ericdrowell
f74955641a fixed multiple bugs related to toDataURL() when using hidden layers 2012-10-07 19:38:12 -07:00
ericdrowell
432533ae4a greatly improved the OO design for draw logic. removed unecessary _draw() and __draw() methods 2012-10-07 19:14:14 -07:00
ericdrowell
f1bc2fe4e8 updated unit tests 2012-10-06 16:11:49 -07:00
ericdrowell
e16935efb3 merge pull request #115 which improves get() design, and also enables the ability to select by node ttype 2012-10-06 15:40:49 -07:00
ericdrowell
07a8848098 updated text shadows unit test 2012-10-06 15:22:51 -07:00
ericdrowell
82bfd9c15a text shadows now work correctly again 2012-10-06 15:19:33 -07:00
ericdrowell
a3840fdc69 moved line cap logic to shape level so that Path can also utilize line caps 2012-10-06 15:05:03 -07:00
David Johansson
8e03a97d46 Improved get method to inlude get by shapeType. Also improved the oo-design. 2012-10-06 23:35:46 +02:00
ericdrowell
6f230fc42b pull request #109 opacity can now be applied to the stage 2012-10-06 13:53:50 -07:00
ericdrowell
3f8801a494 setZIndex now correctly reorders layer canvases 2012-10-05 18:59:03 -07:00
ericdrowell
f5d4228f3b removed load() method from stage. Added Kinetic.Node.create() which creates a node from a json string. This essentially allows us to deserialize any node, including a stage, layers, groups, and shapes. 2012-10-03 20:38:29 -07:00
ericdrowell
a97d3ad01f refactored toJSON() method to work for any node, not just the stage. Improved the OO design following David Johanssons lead, and also added another unit test 2012-10-03 19:38:12 -07:00
David Johansson
fa2c8fb88d Off can remove all listeners in the same name space by .off(".foobar") 2012-10-04 00:50:04 +02:00
ericdrowell
b6eb2cdf82 added mouseenter and mouseleave events. mouseover and mouseout were actually functioning like mouseenter and mouseleave. mouseover and mouseout now work similar to traditional DOM mouseover and mouseout. This change enables event delegation to work correctly 2012-10-03 10:53:09 -07:00
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
8883e80bfe cleaned up _getContentPosition() method and fixed event detections for stages below the fold on mobile devices 2012-08-26 22:42:54 -07: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
39957fba73 just run rectangle instantiation test for now 2012-08-22 23:15:46 -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