Commit graph

66 commits

Author SHA1 Message Date
kangax
f91dd30dc7 Better line length in parser 2013-11-05 11:59:48 +01:00
kangax
6cb941c116 Extract elements parsing into a separate object (ElementsParser) 2013-11-04 17:12:05 +01:00
kangax
ce8fe3447d Break parseStyleAttribute apart 2013-11-04 16:41:26 +01:00
Kienz
5017bc6626 [BACK_INCOMPAT] fabric.StaticCanvas#backgroundImage and fabric.StaticCanvas#overlayImage are fabric.Image instances. fabric.StaticCanvas#backgroundImageOpacity, fabric.StaticCanvas#backgroundImageStretch, fabric.StaticCanvas#overlayImageLeft and fabric.StaticCanvas#overlayImageTop were removed.
`backgroundImage` and `overlayImage` are now `fabric.Image` instances
New property `overlayColor` (analog to `backgroundColor`) - should be set with `canvas.setOverlayColor`
`backgroundImageOpacity` was removed => use `fabric.Image#opacity`
`overlayImageLeft ` was removed => use `fabric.Image#left`
`overlayImageTop ` was removed => use `fabric.Image#top`
`backgroundImageStretch` was removed => use `fabric.Image#width` and `fabric.Image#height`. If you scale your canvas you have to adjust the backgroundImage width/height manually.
Update SVG output.
Add 2nd parameter `firstLetterOnly` to `fabric.util.string.capitalize` => only first letter is transformed to uppercase (other letters stay untouched)
Add `preserveAspectRatio="none"` to `fabric.Image#toSVG` (otherwise streched backgroundImage and overlayImage didn't work as expected)
Update examples - TODO: Update jsfiddles for `setBackgroundImage` and `setOverlayImage`
Add unit test

Closes issue #270
2013-11-03 13:09:49 +01:00
kangax
167f2fa089 Move shared attributes out of parser since it's needed by many "classes" 2013-10-28 14:01:44 +01:00
kangax
5717df817b Fix error when parsing gradient-based fill attribute. Closes #749 2013-08-07 13:51:59 +02:00
kangax
72ef6c67fa Parse lineHeight in style attribute. This fixes IE11's only failing test. 2013-07-11 20:39:45 +02:00
kangax
be8e921e57 Fix nested matrix multiplication. Closes #705 2013-06-13 23:10:33 +02:00
kangax
2223b1b61f Remove more functions in distribution when SVG import (parser) is not included. Always include stateful mixin. Closes #662 2013-05-30 21:55:26 +02:00
Kienz
2c29c0cfab Fix typo, add hsl/hsla (with whitespaces) unit tests and move stuff outside of functions 2013-05-25 19:42:31 +02:00
Kienz
66fc8f4d4b Parse SVG stroke-opacity and fill-opacity
- SVG attribute opacity is now used for object's opacity
- fill-opacity and stroke-opacity are added to stroke and fill color value
- Add hsl/hsla support (e.g. hsl(270, 80%, 10%), hsla(320, 10%, 66%, 0.5))
- Add support for rgb/rgba values with whitespaces around values (e.g. rgba( 255 , 100 , 50 , 0.1 )) and percentage values (e.g. rgb(100%, 67%, 15%, 0.8))
- Delete stroke and strokeWidth from fabric.Text (defined in fabric.Object)
- New unit test for parse stroke-opacity and fill-opacity
- Update unit tests (new tests for hsl/hsla and rgb/rgba (whitespaces and percentage values))
- Change equal and deepEqual parameter order (e.g. equal(actualValue, expectedValue, message))
- Doc additions
2013-05-25 11:03:09 +02:00
kangax
1ed4e40bdf Move brushes to /brushes and mixins to /mixins. Organize ATTRIBUTE_NAMES to use fabric.SHARED_ATTRIBUTES. 2013-05-18 16:43:49 +02:00
Kienz
d80fec5df1 Better strokeDashArray support + Fixes
- fabric.Text has now strokeDashArray support (only native support)
- fabric.Text.fill = null should now work
- Fix save/restore context in render methods => setLineDash affected drawBorder/drawControls
- Add strokeLineCap (default "butt"), strokeLineJoin (default "miter") and strokeMiterLimit (default 10)
- Add support for fabric.Object#fromElement for strokeDashArray (and other stroke properties)
- Add @default tag to properties (JSDoc 3)
- strokeDashArray now only works if stroke property is defined
- Add trokeLineCap (default "round"), strokeLineJoin (default "round") to fabric.BaseBrush
- Updated unit tests
2013-05-18 13:01:34 +02:00
kangax
c65b1f5e7d Add support for parsing shorthand font declaration in styles, such as "font: italic 12px Arial,Helvetica,sans-serif" 2013-05-12 13:01:23 -04:00
kangax
eeecde62a8 Normalize style values. Closes #598 2013-05-01 02:58:59 -04:00
kangax
c16dcf88a4 Change inline docs to conform to jsdoc3 2013-04-24 12:58:04 -04:00
kangax
e56d37d9da Fix text and line rendering in path group. Add support for multiple declarations in "transform" attribute. Fix stroke color of line. Version 1.1.7 2013-04-18 21:42:46 -04:00
Tim Andres
3950298c75 Changed nestTransformMatrices to mutilplyTransformMatrices 2013-04-17 13:54:11 -04:00
Tim Andres
e2bba99e98 Fixed path translation bug with SVG parsing 2013-04-16 01:49:42 -04:00
Stefan Kienzle
9c76ba0f92 Add svg element to async objects (reviver)
If async objects parsed (image), the reviver svg element is undefined.
You can see it here:
http://jsfiddle.net/Kienz/nhYww/
2013-04-05 19:06:02 +03:00
kangax
4c5df5ea0c Specify that loadSVGFromURL uses XHR and conforms to SOP 2013-04-02 13:47:47 +02:00
kangax
5a91472bdc Remove trailing comma 2013-02-17 13:26:45 +01:00
Kienz
5e81f7ab09 Add backgroundColor to svg output
Add backgroundColorPattern to svg output
Bugfix backgroundImage in sag output - width/height are depend on backgroundImageStretch
Bugfix in setBackgroundColor - rename pattern to repeat
2013-02-14 22:06:01 +01:00
kangax
8b04e286a8 Log full errors instead of just its messages 2013-02-04 20:49:05 +01:00
kangax
c11abb377f Fix tests. Build distribution. Version 0.9.35. 2012-12-23 15:28:08 +01:00
kangax
a7a6c38384 Fix incorrect parsing of fontSize which made text not appear when loaded from SVG. Closes #331. 2012-12-23 15:18:46 +01:00
kangax
c8172be31d Final doc additions. Every public method is now documented! 2012-12-16 20:44:26 +01:00
kangax
3416d8a090 Documentation additions. 2012-12-13 15:46:06 +01:00
kangax
f0b5329157 Doc additions, fixes. 2012-11-23 13:38:26 +01:00
kangax
84a956c4b6 Lint everything with JSHint. Version 0.9.14. 2012-10-14 02:53:12 +02:00
kangax
9a7d40d7d7 Change the way gradients are initialized.
They no longer need `ctx` property, which is now taken from object directly during rendering time.
Add unit tests for gradients.
2012-08-20 18:23:53 +02:00
joshpearce
5923e008f7 Update src/parser.js 2012-08-19 21:36:37 -03:00
Josh Pearce
cf7a6d1482 Added reviver method in parser
The optional method is used when asking fabric to
load an SVG file and parse it, instantiating fabric objects.
After each fabric object is created, reviver(ele, obj) is
called so you can parse our custom attributes, or do
anything else custom.
2012-08-19 16:07:28 -04:00
kangax
3ce8507932 Implement fabric.Text.fromElement. Closes #182. 2012-08-11 18:59:53 +02:00
kangax
b701627f42 Fix "stroke-width" being ignored in style attribute. 2012-06-10 12:13:12 +02:00
Tim de Koning
804de6094c Why shouldn't we allow GET parameters? Dynamicly generated SVG files (based on GET params) should be supported to 2012-01-20 11:29:51 +01:00
Tim de Koning
f71f634afd IE8 and lower now actually render and show any loaded SVG 2012-01-18 10:44:03 +01:00
Tim de Koning
364e76713c fabric.loadSVGFromString should work on IE8 and lower... 2012-01-17 17:29:45 +01:00
Tim de Koning
da9c75c073 improved doctype removal regex 2012-01-17 16:30:23 +01:00
Tim de Koning
17931fb764 fix for unittest "fabric.Parser.parseStyleAttribute" compliance in < IE8 2012-01-17 15:24:25 +01:00
Tim de Koning
26d6176928 fix for unittest fabric.util.loadSVGFromString in < IE8 2012-01-17 14:41:58 +01:00
kangax
d870410a7d First (and almost complete) implementation of fabric.Canvas#toSVG. 2012-01-02 16:14:20 -05:00
kangax
f3a3e81ea2 [BACK_INCOMPAT] Fix JS error when calling fabric.Image#toDataURL. toDataURL is now asynchronous, and passes data url to callback (first argument) instead of returning it. Closes #79. 2011-11-18 10:44:53 -05:00
kangax
48da79220f Fix fabric parser to workaround o3-xml bug with gEBTN("*") 2011-08-16 19:05:17 -04:00
kangax
b53d794af6 [BACK_INCOMPAT] Custom fabric build is now created with node.js and is much more flexible. Sprockets is no longer required to build fabric. Parser and node are now optional modules, which means that parseSVGDocument is no longer included in default fabric build. 2011-08-14 17:35:36 -04:00
kangax
35ad4bf6e3 Preparing fabric to run on node.js 2011-08-05 19:00:26 -04:00
kangax
628efcdc70 fabric.Element is renamed to fabric.Canvas, which makes more sense. fabric.Element is kept for compatibility reasons (but is deprecated). Bump version to 0.3. 2011-06-28 19:14:40 -04:00
kangax
ef425d18c5 Fix some of the parser.js unit tests by making resolveGradients more lenient. 2011-02-11 01:44:08 -05:00
kangax
ca11620451 Replace map with for loop for perf. reasons (as this method is likely to be called thousands of times). 2011-02-09 01:03:04 -05:00
kangax
ba4486e5be Use Array.prototype.slice to convert nodelist to an array (slice is usually faster; it makes sense in this context where nodelists (i.e. shapes) could consist of thousands of elements). 2011-02-09 00:14:12 -05:00