Commit Graph

362 Commits

Author SHA1 Message Date
Eric Rowell
13c540b969 removed beforeDraw and afterDraw methods. you can now subscribe to draw events with .on('draw') or .on('beforeDraw'). Draw events also bubble 2013-03-24 01:05:37 -07:00
Eric Rowell
542f675522 added getNodeType() and getShapeType() methods 2013-03-24 00:14:42 -07:00
Eric Rowell
3a903d6c7c minor refactoring. fixed bug related to click mapping 2013-03-23 23:19:24 -07:00
Eric Rowell
ce793a4b25 refactored / cleaned up code in Node and DD 2013-03-23 22:56:22 -07:00
Eric Rowell
c31abf6be3 changed getUserPosition to getPointerPosition, and setUserPosition to setPointerPosition 2013-03-23 20:15:49 -07:00
Eric Rowell
966ebf2a32 lots of refactoring, and code hardening. Also fixed bug in which dragend events were being fired before mouseup/touchend events 2013-03-23 20:02:11 -07:00
Eric Rowell
0c80f6e223 rewrote dynamic drag and drop layer because the old implementation had too many problems. This resolves all of the dynamic drag and drop issues in one go. draw() method can now be applied to any node, not just the Stage and Layers. drag events now bubble 2013-03-22 00:46:41 -07:00
Eric Rowell
0dbda82886 created _upperCase util method for function and event name generation, and did some refactoring 2013-03-21 20:24:03 -07:00
Eric Rowell
9db24812bd removed simulate method. refactoring also fixed bug in which if you fire a custom event that has not been registered, the script no longer fails 2013-03-21 19:43:17 -07:00
Eric Rowell
2c237aa708 Merge pull request #329 from Rulexec/master
Thorfile typo fix and chainable on/off.
2013-03-20 10:01:04 -07:00
Eric Rowell
c9d6820dbf refactored transition logic and added getAttr method 2013-03-15 16:19:12 -07:00
Eric Rowell
69f9374c8e first pass at removing setDefaultAttrs logic to speed up node instantation performance 2013-03-15 08:33:05 -07:00
Alexander Ruliov
9b5d33325d chainable .on/.off and Layer.(before/after)Draw. closes #279 2013-03-15 01:07:35 +03:00
Eric Rowell
66cc6cd98c added support to define pixel ratio with Canvas constructor 2013-02-12 10:29:23 -08:00
Eric Rowell
5e65b4c596 refactored pixel ratio scale logic 2013-02-12 00:20:24 -08:00
Eric Rowell
79fecd2c13 dynamic drag layer setup now does deep copy of Groups and Layers when reconstructing ancestors 2013-01-28 21:27:08 -08:00
Eric Rowell
b1038e99bf pulled Node config params and Shape config params into a textfile, and now using token replacement to auto fill Node and Shape config params throughout the code base. In this way, if I need to make changes to the Node or Shape configs, those changes are propagated to all of the other constructors 2013-01-26 20:42:19 -08:00
Eric Rowell
8ed84f474a fixed several memory issues with transition logic. Heavily refactored Transition module. New Animation isRunning method. destroy() method now correctly stops currently running transitions. added several transition and destroy related unit tests 2013-01-13 19:59:35 -08:00
Eric Rowell
b6ba1a503c ids and names hashes used for node selection via get() has moved to Global in order to greatly simplify the selection logic. This means that node ids and names are shared across all stages. If two stages each have a node with the same id, only the last id set will be accessibile (similar to DOM) 2013-01-13 11:10:49 -08:00
Eric Rowell
ed579e4843 added new destroy Node method which removes and destroys a node. remove() now simply removes a node from the stage. You can re add the node at a later time with add(). getDOM() changed to getContent(). stage.remove() now correctly removes content node 2013-01-12 22:01:12 -08:00
Eric Rowell
4136ddb398 added new dragOnTop property which allows you to define whether or not a node is automatically moved to a temp top layer when dragging 2013-01-09 23:45:30 -08:00
Eric Rowell
db4a972fb2 updated more docs 2013-01-03 00:00:10 -08:00
Eric Rowell
31ad5fca88 updated docs 2013-01-02 21:35:51 -08:00
Eric Rowell
a53db90d0a flattened fill attr, created new Node getter and setter generators that handle type conversions for points, sizes, and rotations 2013-01-01 23:54:02 -08:00
Eric Rowell
206f7bf8d0 fixed up group drag and drop 2012-12-31 01:47:49 -08:00
Eric Rowell
9cd0df651c leveraged new eachAncestorReverse() method where possible 2012-12-30 23:48:46 -08:00
Eric Rowell
7ba40a6a68 drag and drop operatons now dynamically generate a temporary top layer for high performance drag and drop. When completed, the top layer is removed. Also cleaned up a bit of drag and drop logic 2012-12-30 23:14:23 -08:00
Eric Rowell
375c64a332 added counter pixel ratio method so that drawings aren't double scaled when using toDataUrl and toImage 2012-12-21 22:51:57 -08:00
Eric Rowell
aa05f90ea4 updated stage docs 2012-12-16 20:52:07 -08:00
Eric Rowell
5e16b3d7d0 fix bug 169 when removing a node, be sure to also remove the drag and drop reference 2012-12-13 00:01:24 -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
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
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
393a9687dc adjusted anonymous function wrapper for Node and Shape so that jsdocs wouldn't get tripped up 2012-11-26 20:42:01 -08:00
Eric Rowell
511e4618ba improved Node documentation 2012-11-26 19:12:02 -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
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
38d78cc53a added local cached variables to improve performance for Node and Shape 2012-11-14 00:07:59 -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
3c3351ec6f removed ATTRS class level variable cache from Shape. added class level variable cache to Node. Made several low level optimizations. 2012-11-13 23:22:56 -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
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
a30d6730fe documented Filters namespace, filters, and Transform class, and cleaned up jsdoc warnings 2012-11-11 17:08:16 -08:00
Eric Rowell
4cc505446a updated docs 2012-11-05 07:33:54 -08:00
Eric Rowell
32e72176ca isListening() method now takes into account ancestor listening 2012-11-03 22:20:46 -07:00
Eric Rowell
257497755b added defensive coding to _handleEvent() method which fixes a bug related to canceling stage drag and drop while dragging 2012-11-03 21:49:20 -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
df829e1e89 fixed up toImage() docs 2012-11-03 16:08:29 -07:00
Pavel Akhmetchanov
4536f3cdef Update src/Node.js
replace function simulate. Added event attribute.
2012-11-02 17:59:17 +06:00
Eric Rowell
3d0cb26e6d updated build file to also minify modules separately for custom builds. Started work on decoupling Animation and DragAndDrop logic from other modules 2012-10-14 18:46:04 -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
b025767a27 updated jsdocs. TextPath setText() now calls Text setText(). Polygon setPoints() method now has data conversion logic similar to Line 2012-10-07 21:12:45 -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
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
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
f235ea032d improved OO design for remove() and add() 2012-09-26 19:26:53 -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
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
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
ericdrowell
a349fa488c fix #96 setting text to integer data types no longer fails 2012-09-23 18:41:05 -07:00
ericdrowell
9fde3036f7 #fix 97 2012-09-23 18:29:15 -07:00
ericdrowell
24e3aa2c03 added isListening and isDraggable aliases for consistency 2012-09-23 16:06:44 -07:00
David Johansson
a8cacb28e3 Merge remote-tracking branch 'upstream/master' into custom-dragBounds 2012-09-24 00:16:43 +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
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
Adam Wróbel
a9811a8adc Fix Layer.moveToBottom/moveDown when only one layer is present.
Removes references to undefined objects.
2012-09-14 13:08:42 +02:00
Eric Rowell
f08701e347 added radius type checking in setAttrs method 2012-08-26 00:11:46 -07:00
Eric Rowell
ddfcab2d55 layer reordering now correctly reorders scene canvases 2012-08-25 22:26:25 -07:00
David Johansson
923b4d9c91 Merge remote-tracking branch 'upstream/master' into custom-dragBounds
Conflicts:
	dist/kinetic-core.js
	dist/kinetic-core.min.js
	src/Node.js
2012-08-23 22:39:25 +02:00
Eric Rowell
d48aa321f4 removed resig's Class dependency to test performance gain 2012-08-22 23:13:09 -07:00
Eric Rowell
cb68fa0215 fixed bug with isDragging method 2012-08-20 23:10:05 -07:00
Eric Rowell
15aeabacc1 added logic to correctly draw buffer paths for cases where a developer is creating an invisible mask for event detections 2012-08-20 22:11:13 -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
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
9cdbadc4fd refactored ancestor comparison logic to ensure that container handlers aren't incorrectly executed for mouseover mouseout. Fixed up functional tests 2012-08-16 22:03:39 -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
David Johansson
aaeb49acf4 Using new pos from return instead of by reference. 2012-08-13 22:44:08 +02:00
David Johansson
15fe79873c Added support for dragBoundFunc where custom dragbounds (or constraints) can be defines. 2012-08-13 21:19:36 +02:00
Eric Rowell
66ba99f9bc hooked drag and drop into animation engine 2012-08-09 00:01:21 -07:00
Eric Rowell
58cabf8ddc hooked node transitions and sprite animation into new animation API 2012-08-08 23:41:16 -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
b7ac415ea6 transition callback is now executed immediately after final node draw 2012-07-31 21:01:48 -07:00
Eric Rowell
eccd8b7e64 silky smooth animations. got rid of layer and event throttling, and instead created dragThrottling. The dynamic animation frame rates already handles optimized animation drawing, we just needed to add manual throttling to drag and drop. Animations are now very smooth, and drag and drop is still smooth 2012-07-26 23:26:58 -07:00
Eric Rowell
5f7b6018fa finally got around to documenting the Node, Group, Stage, Shape, Layer, and Container constructors 2012-07-23 22:39:55 -07:00
Eric Rowell
3997d74317 updated more docs 2012-07-23 00:00:22 -07:00
Eric Rowell
3617d8ef5f updated docs 2012-07-22 23:30:56 -07:00
Eric Rowell
781a2ebe60 fixed a few bugs discovered with integration testing. added some performance tweaks 2012-07-21 21:09:02 -07:00
Eric Rowell
f1cb695e1f you can now cache regions of a node outside of the stage viewport. added more unit tests 2012-07-21 15:38:25 -07:00
Eric Rowell
d74ec8ab06 fixed new bug with stage toDataURL that was introduced with the new Canvas class, and added new filter unit tests 2012-07-21 13:29:22 -07:00
Eric Rowell
4b0b3a2a20 now that things are drawn onto arbitrary canvas elements wrapped with the Canvas class, it's now possible to create temp canvases on the fly, which enables correct-size image filtering, and no limits on node caching 2012-07-19 23:30:59 -07:00
Eric Rowell
d8bbbf6353 new Canvas class to decouple layer and canvas, providing more flexibility. drawing operations now require a canvas object rather than an optional layer which contained a canvas. fixed some transformation issues introduced with a pull request that I pulled in last week 2012-07-18 23:28:45 -07:00
Eric Rowell
20adf7e036 first pass at implementing filters. Still have a lot to work through. 2012-07-17 00:32:26 -07:00
Eric Rowell
384a686740 worked through some synchronous / asynchronous issues with toDataURL and toImage(). stage toDataURL() is now asynchronous, and all other node toDataURLs is still synchronous. toImage() is now asynchronous. Kinetic.Image once again only accepts image objects, and can no longer be instantiated with a data URL or image data due to asynchronous issues. It's much cleaner for the developer to load an image however they like, and then instantiate a Kinetic.Image shape synchronously 2012-07-15 20:12:18 -07:00
Eric Rowell
6dc7c685f0 new toImage() method to support node caching 2012-07-14 23:41:16 -07:00
Eric Rowell
4692c51c74 toDataURL() is now synchronous, and works with all nodes, including the stage, layers, groups, and shapes. This also sets things up nicely for node caching. You can now cache anything, including the whole stage, layers, groups, or shapes, manifested as Kinetic Images that were instantiated with data urls 2012-07-14 18:10:37 -07:00
Eric Rowell
d62df7ba5c setup filters. saveImageData can now work for any nodes, including shapes, groups, layers, and the stage. images can now take image data as a parameter. This enables shape caching. New beforeAttrChange event which fires before an attr is changed 2012-07-14 16:25:56 -07:00
Eric Rowell
5bfcf3ffa8 the stage ids and names hashes are now updated correctly whenever a node's id or name changes 2012-07-13 21:24:38 -07:00
Eric Rowell
9a83d3dfdf on attr change handler eent object now contains oldVal and newVal property 2012-07-13 20:06:28 -07:00
Vijai Ramcharan
41299d7f98 Moved center offset translation from drawing to getTransform()
This fixes an issue where getAbsolutePosition() would not work when
used with a parent that has a center offset applied.
2012-07-10 20:28:42 +02:00
Eric Rowell
780d5568db updated the documentation for all methods to reflect the new inhertiance changes. And yes, if you're curious, it took forever. 2012-07-08 21:56:52 -07:00
Eric Rowell
30fd5c1fa7 greatly improved sprite animation performance by hooking into the global animation object 2012-07-07 21:39:03 -07:00
Eric Rowell
a8ab9a2533 implemented clone method (inspired by matteo78) and added thorough unit tests 2012-07-07 14:43:12 -07:00
Eric Rowell
7f7cd24838 attr change events no longer bubble. updated functional test data urls 2012-07-07 11:52:04 -07:00
Eric Rowell
014d4f198f fixed mouseover / mouseout incorrectly firing when moving from one node to another node inside the same container 2012-07-06 00:27:55 -07:00
Eric Rowell
de7cab4cf3 moved animation logic into Animation.js. Global.js now only contains logic and properties that operate on stages 2012-07-03 23:00:52 -07:00
Eric Rowell
6126c73a84 moved data type logic into new utility files Type.js and renamed GlobalObject to Global 2012-07-03 22:08:59 -07:00
Eric Rowell
17644fcb8f made performance improvement for isVisible method, suggested by mysza 2012-07-03 12:59:31 -07:00
Eric Rowell
3d4d2d20c0 now utilizing John Resig's mashup of Base.js and protototype.js inheritiance Class so that it's easy for developers to extend KineticJS objects with extend() or to simply tack on new methods and properties that's available to all children classes. Moved getter and setter logic to Node. Moved transition class to root directory and created Tween class 2012-07-03 12:07:27 -07:00
Eric Rowell
31566bff13 transition attr updates now fire the attr change event. Fixed problem with root level attrs not being fired when child level attr changed 2012-07-01 00:19:56 -07:00
Eric Rowell
6663b9e612 first pass at implementing auto word wrap. Still have a few edge cases to cover. Removed vertical align property as it is no longer relevant 2012-06-30 00:40:54 -07:00
Eric Rowell
07ef653441 completely rewrote the Text shape. Kinetic.Text is now a Group that's composed of a Rect and a custom shape that draws text. align and vertical align now apply to the text alignment inside the text box. box rounded corners are now possible since Text uses Rect. Shadow logic improved. Beefed up the text getter and setter unit tests 2012-06-27 19:50:32 -07:00
Eric Rowell
c1a08d8073 created new addSettersGetters method, further enhanced dynamic getters and setters 2012-06-23 18:09:10 -07:00
Eric Rowell
19750782c7 improved drawing speed by 7% by optimizing stroke(), fill(), and several other methods 2012-06-22 19:36:37 -07:00
Eric Rowell
422791a99a cleaned up undefined, null, 0, and '' comparison operators. To unset a attribute, you can now set it to null, 0, or ''. Setting an attribute to undefined will have no effect 2012-06-22 13:15:29 -07:00
Eric Rowell
5765ab749b converting arguments object into true array for setters, restored the original underscore.js methods, and moved radius conversion logic from the setAttrs method to a radiusChange event listener in Ellipse 2012-06-20 12:55:34 -07:00
Eric Rowell
ce5a8f3209 you can now cancel drag and drop with setDraggable(false) during a drag and drop operation 2012-06-19 17:06:31 -07:00
Eric Rowell
76c85a639e changed listen property to listening, listen() to setListening(), and isListening() to getListening() for consistency 2012-06-18 23:12:56 -07:00
Eric Rowell
c8d8aa6028 changed draggable() to setDraggable(). added getDraggable(). added more unit tests and functional tests 2012-06-18 22:02:13 -07:00
Eric Rowell
fae1ff6cb7 removed Circle shape and replaced it with the more flexible Ellipse shape. If you define the radius with a number, the shape will be a circle. if you define the radius with an x and y component, it will be an oval 2012-06-17 16:50:04 -07:00
Eric Rowell
73ad904de6 updated jsdocs 2012-06-14 02:19:51 -07:00
Eric Rowell
2455000f5c fixed set fill attr bug which occurred when instantiating the fill with a string color and then setting it later to a fill object such as a gradient or pattern. The fix will apply to any attr which can be a string or object 2012-06-12 09:57:29 -07:00
Eric Rowell
6d4738cd2b all simple getters and setters are now dynamically created. This is the first step towards creating a code base that can unpack at run time to reduce file size 2012-06-10 13:07:09 -07:00
Eric Rowell
13105969b1 attr change events are now only fired on root level attr changes. changed centerOffset property to offset property for consistency. did additonal refactoring 2012-06-09 16:13:25 -07:00
Eric Rowell
bba1d0ad21 now leveraging the setAttrs method for all setters in Node class. utilizing draggableChange attr event to trigger drag and drop inits 2012-06-09 15:31:25 -07:00
Eric Rowell
e64024d3bd refactored attr event change logic a bit. added delete operator in a couple places to fix memory leaks. added better event unit tests. 2012-06-09 10:53:47 -07:00
Eric Rowell
12b61b3621 attr change events are now triggered for any root attr so long as the attr is set with the setAttrs method 2012-06-09 01:47:41 -07:00
Eric Rowell
2cd24309ac first step to exposing event driven architecture. Devs can subscribe to attr change events with the on method. e.g. shape.on('widthChange', function(){...}) 2012-06-08 21:56:33 -07:00
Eric Rowell
440c3ac279 event simulation now correctly bubbles 2012-06-08 20:57:20 -07:00
Eric Rowell
e7699a588f fixed mobile drag and drop bug. refactored _handleEvents(). added new functional test that has two drag and drop shapes 2012-06-08 00:42:48 -07:00
Eric Rowell
e74fa3a319 fixed stage drag and drop bug on tablets 2012-06-03 12:48:13 -07:00
Eric Rowell
8b22fb0690 updated Transition docs 2012-06-03 10:36:50 -07:00
Eric Rowell
91eb4ea371 isVisible() method now takes into account ancestor visibility. This fixes several bugs related to odd event detection behavior with clusters of visible and invisible nodes 2012-06-02 19:12:06 -07:00
Eric Rowell
1b333bc800 new simulate() method to simulate node events. e.g. shape.simulate('click') 2012-06-02 00:21:49 -07:00
Eric Rowell
4488f22c32 added drag and drop support for the stage. This essentially enables stage panning 2012-05-27 00:07:36 -07:00
Eric Rowell
af31e1ee83 refactored stage.reset method. Now storing node default attrs as an object which can be used by the stage to reset itself 2012-05-26 18:40:43 -07:00
Eric Rowell
44ba6f7e5b bug fix - when setting a custom attr that points to self, the setAttrs method no longer gets stuck in a recursive loop throwing a stack overflow error. Also, objects that were instantiated from a class (non-literal objects) are no longer serializable 2012-05-26 18:31:13 -07:00
Eric Rowell
07edfbc765 hooked setAttrs into setCrop() method and made the _getSize() method more flexibile by accepting more variations of input. added unit tests 2012-05-26 16:37:37 -07:00
Eric Rowell
8c675327b9 hooked in the setAttrs method to the shadow setter and the pattern fill setter. added more unit tests 2012-05-26 10:57:56 -07:00
Eric Rowell
0bb158c0fb hooked setAttrs into setPosition and setScale for more flexibility. Added in depth position and scale unit tests. add() and remove() methods are now chainable 2012-05-25 20:18:05 -07:00
Eric Rowell
e60eb8be6e tons of refactoring to make the code base even more elegant and flexibile. In particular, the setAttrs() method is much more powerful now, and serves as a really convenient way for setting a bunch of node properties at once 2012-05-19 21:14:04 -07:00
Eric Rowell
c6040ebf9d a bit of refactoring here and there, added some getters and setters that i missed in Kinetic.Sprite 2012-05-13 14:04:29 -07:00
Eric Rowell
ec415c55de added _setPoints so that points setter methods could leverage the same logic that was in the setAttrs() method 2012-05-13 11:58:40 -07:00
Eric Rowell
7f8a174b51 fixed bug with _setSize() 2012-05-13 11:32:26 -07:00
Eric Rowell
7be0e5f577 refactored _getXY utility and usage 2012-05-13 10:46:49 -07:00
Eric Rowell
81df49e75d pulled out _setPointAttr from Node and moved it to the GlobalObject as _setXY, which enables x,y property setting for any object, not just attrs. also added _setSize which has similar logic for height width properties 2012-05-12 18:37:07 -07:00
Eric Rowell
1146919d3d modified setDefaultAttrs() so that it doesn't overwrite attrs defaulted in a custom class that extends a Kinetic class 2012-05-12 15:15:42 -07:00
Eric Rowell
2993191fe6 improved shadow logic such that it first attempts to apply shadows to a shape's fill if it's defined, otherwise it will attempt to apply the shadow to the stroke 2012-05-09 19:15:49 -07:00
Eric Rowell
a27741ce03 added shadow support. changed fillStroke method to shadowFillStroke 2012-05-08 23:06:13 -07:00
Eric Rowell
622278a510 point properties can now be set with an array of points or an array of numbers for convenience 2012-05-08 22:11:37 -07:00
Eric Rowell
ffd9924511 tweaked throttling algo and added unit tests 2012-04-28 19:52:45 -07:00
Eric Rowell
e8dcb8e584 fixed glitchy flash on transitions when applying multiple transitions to the same node at different times 2012-04-28 17:45:13 -07:00
Eric Rowell
8dce92c2fd introduced new setDefaultAttrs() method which greatly simplifies the logic required inside node constructors. This will also make plugin creation much easier 2012-04-28 12:55:18 -07:00
Eric Rowell
3200a9063a identified a couple public methods in the global object which are actually private 2012-04-28 11:23:47 -07:00
Eric Rowell
9fef9e54d9 added new stage.getIntersects() method which allows you to obtain all the shapes that intersect a given point. Also enhanced all methods that require an x or y by allowing either two arguments to be passed in or an object to be passed in. Example foo(100, 50) or foo({x:100, y:50}); 2012-04-27 23:57:01 -07:00
Eric Rowell
70df77f9fa enhanced setAttrs() logic to allow custom node properties and functions 2012-04-27 19:42:04 -07:00
Eric Rowell
508bfb7a9b rewrote cropping logic from last pull request, fixed serialization issue in unit test, added new unit tests, and added getX() and getY() methods 2012-04-27 19:08:45 -07:00
Eric Rowell
47b8a8e0d6 new setDetectionType() and getDetectionType() methods to enable path and pixel detection swapping 2012-04-14 21:46:38 -07:00
Eric Rowell
a908c59769 fixed center offset + drag and drop bug by fixing a root problem with the getAbsoluteTransform() method. This method no longer takes into account the center offset. Center offset transforms are now applied separately 2012-04-14 18:27:06 -07:00
Eric Rowell
df8df63400 refactored setAbsolutePosition() method and Shape _draw method 2012-04-14 16:27:00 -07:00
Eric Rowell
3a520376e5 fixed stage.hide() bug, created new isVisible() method, and moved visible check to container 2012-04-14 12:04:45 -07:00
Eric Rowell
fb9f324cfb exposed absolute positioning logic inside the _prepareDrag method so that developers have access to it via the setAbsolutePosition() method 2012-04-14 10:40:54 -07:00
Eric Rowell
5c7b969974 new setAttrs() method which enables you to set attributes in bulk 2012-04-12 23:02:55 -07:00
Eric Rowell
30e8973956 added setX and setY methods for convenience 2012-04-08 18:22:04 -07:00
Eric Rowell
3c17e59eb0 moved ids and names hashes to the stage level 2012-04-08 11:01:31 -07:00
Eric Rowell
8c70333472 added simple selector support by id (#) or by name (.). Selecting by name is similar to selecting by class in other DOM libraries 2012-04-07 20:32:24 -07:00
Eric Rowell
d3b025254a new getAttrs() method 2012-04-07 18:50:53 -07:00
Eric Rowell
58eb778e9a re-integrated simple serialization and deserialization with new attrs structure 2012-04-07 14:39:31 -07:00
Eric Rowell
6d618b97b5 first phase of new attrs architecture to better represent Node states 2012-04-05 23:48:58 -07:00
Eric Rowell
15bd27562e continued work on serialization/de-serialization 2012-04-05 20:38:12 -07:00
Eric Rowell
350f7b7496 implemented stage.load() which allows you to deserialize a json string 2012-04-05 00:06:00 -07:00
Eric Rowell
bf86dacb59 setup simple serialization 2012-04-04 22:57:36 -07:00
Eric Rowell
602220bdce finished new animation, transitions, and tweens functionality 2012-04-03 23:00:35 -07:00
Eric Rowell
f953e4694f tons of refactoring. Now have separate Transition and Tween classes 2012-04-03 22:23:13 -07:00
Eric Rowell
9e3baf69c1 added first phase of transition event subscription 2012-04-03 14:08:06 -07:00
Eric Rowell
fc5825e61e got the unit tests and functional tests passing. Have a few things left to do, and a bit more testing before I merge the transitions rewrite back into the trunk 2012-04-02 23:38:14 -07:00
Eric Rowell
d5834c8351 more new transition architecture integration 2012-04-02 22:54:05 -07:00
Eric Rowell
77aea95e7a round 1 of animation + transition rewrite, while combing Xaric's Tween port 2012-04-02 21:03:59 -07:00
Eric Rowell
6ce9d5489c reworked pixel detection. I now require the dev to use shape.save() to save the pixel data for performance reasons 2012-04-01 19:38:30 -07:00
Eric Rowell
71b0449071 fixed drag and drop issue and reverted default easing back to linear 2012-04-01 10:06:00 -07:00
Eric Rowell
3a8afc747c fixed bug related to multiple drag and drop initializations 2012-04-01 09:32:20 -07:00
Eric Rowell
8398670a47 added new getAbsoluteZIndex() and getLevel() methods to Node 2012-03-31 15:17:36 -07:00
Eric Rowell
9994e8a37e added getSize() method to Stage, Rect, and Image. Also updated unit tests 2012-03-31 00:08:50 -07:00
Eric Rowell
fbb6d0f706 again reworked the matrix transform logic with drag and drop 2012-03-25 12:45:46 -07:00
Eric Rowell
8ee223584d added support for evt.shape so any event handler can have access to the shape that was interacted with 2012-03-24 21:11:42 -07:00
Eric Rowell
f312c0cf9d reworked transformation matrix operations with drag and drop 2012-03-24 20:52:17 -07:00
Eric Rowell
1fa41e6692 changed Matrix classname back to Transform 2012-03-24 10:03:28 -07:00
Eric Rowell
68f9688575 finished matrix integration. the stage, layers, groups, and nodes can be transformed in anyway, and drag and drop on any of these nodes now works great regardless of parent node transforms 2012-03-23 23:39:54 -07:00
Eric Rowell
7ced50f694 changed Stage constructor to accept a config object. Now that Stage is a node, every KineticJS object requires the same config object which bubbles up through the parent classes 2012-03-22 23:17:52 -07:00
Eric Rowell
0da8adfb6e added Matrix.js and started integration 2012-03-22 13:47:37 -07:00
Eric Rowell
8aa5fcf560 fixed clear transition bug 2012-03-20 22:46:54 -07:00