Commit graph

83 commits

Author SHA1 Message Date
asturur
35eebc0376 Update parser.js 2014-06-21 14:22:10 +02:00
asturur
54f5cf11e5 Update parser.js
Get rid of error stopping the parser for elements that doesn't have a parent with visible defined.
2014-06-21 14:19:31 +02:00
Jim Rodovich
74b0329abd Fix error when parsing empty SVG document.
And don't forget to call the callback.
2014-05-15 16:31:01 -05:00
Juriy Zaytsev
a20e329213 Merge pull request #1317 from rodovich/leading-decimal
Be able to parse numbers with no digits before the decimal point.
2014-05-09 00:31:46 +02:00
Jim Rodovich
5b54f83548 Be able to parse viewbox numbers with no digits before the decimal. 2014-05-08 11:28:11 -05:00
Jim Rodovich
ed0b91109d Be able to parse numbers with no digits before the decimal point.
Per the [SVG spec](http://www.w3.org/TR/SVG11/types.html#DataTypeNumber), non-integer number values do not necessarily have any digits before the decimal point.
2014-05-08 11:20:56 -05:00
Jim Rodovich
95fd97fa63 Perform imported SVG rotations in degrees, per the SVG spec.
http://www.w3.org/TR/SVG11/coords.html#TransformAttribute
2014-05-08 10:56:32 -05:00
kangax
314e06db6d Fix fontWeight parsing 2014-04-18 16:07:59 -04:00
kangax
b3600e62a4 Add support for text-anchor's 2014-04-18 16:07:49 -04:00
kangax
c8164959c8 Add support for SVG "visibility: hidden" 2014-04-16 14:05:34 -04:00
kangax
a48ed5b31b Add support for display=none. Closes #1256 2014-04-10 17:47:36 -04:00
kangax
cfd71e9550 Fix viewBox parsing 2014-04-10 13:57:24 -04:00
kangax
2acdc7e85b Fix few bracketless statements. Down to 257 failures on JSCS. 2014-02-27 15:00:42 -05:00
Michael Sievers
179ad93dc5 Make ElementsParser a constructor function and create instances in fabric.parseElements 2014-02-18 13:43:19 +01:00
kangax
d2f6a9033e Add JSCS validation & change bunch of things for conformance. Down to 333 failures from ~1000. 2014-02-16 16:36:14 -05:00
Marco Miltenburg
b97f850bbb Added check to make sure xml is defined and exit if undefined. 2013-12-18 13:44:04 +01:00
kangax
ec8a920081 Reorganize parser.js 2013-11-21 18:00:29 +01:00
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