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
429f28964a
wrapped Shape module with anonymous function, added variable cache, and reduced object attr access calls
2012-11-13 22:54:08 -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
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
353cd939bd
readded linecap attr to shape level
2012-10-10 20:00:27 -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
ericdrowell
fcd4b345fc
moved cornerRadius proprty to Shape level
2012-10-06 15:55:10 -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
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
f235ea032d
improved OO design for remove() and add()
2012-09-26 19:26:53 -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
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
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
89611aed5f
rounding pos components when used with getImageData
2012-08-26 12:23:29 -07:00
Eric Rowell
79a1029adb
fixed getIntersections bug
2012-08-26 11:00:18 -07:00
Eric Rowell
1ad2530889
removed john resig's Class class because it was really slowing down node instantiations. Created a custom solution that's much lighter weight, and about 50% faster
2012-08-22 23:35:21 -07:00
Eric Rowell
d48aa321f4
removed resig's Class dependency to test performance gain
2012-08-22 23:13:09 -07:00
Eric Rowell
7b4ec5e6c8
changed bufferImage property to imageBuffer
2012-08-21 19:42:29 -07:00
Eric Rowell
4b142db887
don't apply buffer fill if fill is not defined and shape contains an image
2012-08-21 19:32:04 -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
92208d8e56
moved color key generation logic from Container to Shape so that it's generated immediately, instead of on add
2012-08-20 21:55:05 -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
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
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
Eric Rowell
0f1a424840
prototyping back buffer hit detection algo
2012-08-10 22:33:22 -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
Eric Rowell
ce3b98ee9c
added some performance tweaks and polished up code here and there
2012-07-26 22:58:38 -07:00
Eric Rowell
4410ce9982
fixed bug with fillText in Shape class
2012-07-24 22:34:53 -07:00
Eric Rowell
ebf324484d
updated Shape constructor docs
2012-07-23 22:43:04 -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
Caleb Troughton
0a1d632900
Fix getStrokeColor -> getStroke in Shape docs.
2012-07-23 11:35:06 +08: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
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
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
2629c1237c
cleaned up intersects logic, and added more docs
2012-07-14 18:41:34 -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
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
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
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
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
3b6dffe6e1
refactored Image event bindings and fixed radial gradient bug
2012-06-24 13:39:36 -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
6b36c7ed93
cleaned up shadow logic and defaults in _applyShadow
2012-06-22 19:58:36 -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
dc51d95eb1
image fills can now be scaled to simulate image cropping. Now that image fills can be offset and scaled, the Image Shape is now obsolute because any shape can now use regular images or cropped images.
2012-06-17 17:18:49 -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
6b70e1b18f
now using setAttrs for all Shape and shapes setters
2012-06-10 00:02:16 -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
9f243d4a2e
garbage collecting empty arrays in _removeName method to free up space
2012-06-02 00:39:17 -07:00
Eric Rowell
e075a725a1
rewrote shadow logic. Shadows can now be applied to images and sprites, even if they have transparent pixels
2012-05-26 20:34:36 -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
61d325d383
fixed up some issues with serialization and deserialization and updated unit tests
2012-05-20 16:42:37 -07:00
Eric Rowell
2331222459
linear and radial gradients can now have any number of color stops
2012-05-20 11:12:07 -07:00
Eric Rowell
4ba2818f97
improved shadow code quality and added support for text fill and stroke shadows
2012-05-20 10:47:28 -07:00
Eric Rowell
7fcf5f156a
added support for shadow alpha property
2012-05-19 22:11:33 -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
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
e4f5e11792
finished up pattern fill support
2012-05-13 10:27:40 -07:00
Eric Rowell
9e3475f37a
setup support for pattern fills
2012-05-12 18:18:06 -07:00
Eric Rowell
51258531bf
fixed bug with getTextSize() which was throwing a JS error if used before adding text to the stage
2012-05-12 15:32:27 -07:00
Eric Rowell
28f7fc246d
changed shadowFillStroke() to applyStyles(). Took applyLineJoin() out of shape draw functions and moved it to the Shape._draw() method.
2012-05-09 22:31:55 -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
16c251bb97
added drawFunc property to layer so that layers can easily draw non-node background graphics
2012-05-09 18:53:20 -07:00
Eric Rowell
a27741ce03
added shadow support. changed fillStroke method to shadowFillStroke
2012-05-08 23:06:13 -07:00
Eric Rowell
f2976e7dd1
added support for linear gradients and radial gradients using the fill property
2012-05-03 14:20:50 -07:00
Eric Rowell
1dbe93a232
added new Line Shape
2012-04-28 21:12:01 -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
c661cff85a
fill, stroke, and strokeWidth values of undefined, null, '', or 0 are now correctly handled
2012-04-28 12:30:14 -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
2879c0763f
changed isPointInShape() to intersects(). Currently the method accepts a point object, but I may extend this to also accept another shape object
2012-04-27 20:54:49 -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
78e4022126
made isPointInShape() a public method for the purpose of collision detection
2012-04-15 09:18:30 -07:00
Eric Rowell
c698005adc
refactored fillStroke() method
2012-04-14 21:53:00 -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
c17029d38e
fixed up fillStroke() logic in the Shape class
2012-04-14 10:47:52 -07:00
Eric Rowell
63c8dde6d5
no longer auto clearing shape data. added new shape.clearData() method instead
2012-04-08 20:25:31 -07:00
Eric Rowell
3243e5f8ff
added support for image de-serialization and cleaned up some of the Shape attr default logic
2012-04-07 19:08:16 -07:00
Eric Rowell
0a94c75e22
decided that the developer should be responsible for setting custom drawing functions, images, and event handlers via selectors rather than a hash map passed into the load() method
2012-04-07 18:40:44 -07:00
Eric Rowell
1a40e50622
finished custom shape serialization with new attrs structure
2012-04-07 15:03:19 -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