Commit graph

518 commits

Author SHA1 Message Date
Juriy Zaytsev
68915cbcb6 Merge pull request #2164 from asturur/Fix-Image-from-Object
Fix image resize filter from object
2015-05-05 11:47:57 +02:00
Andrea Bogazzi
ed5b1b66b0 Fix image resize filter from object 2015-05-05 08:32:30 +02:00
Andrea Bogazzi
80c3012646 Update object_origin.mixin.js 2015-05-02 19:13:44 +02:00
Juriy Zaytsev
91897de495 Merge pull request #2153 from asturur/iTextGlitch
I text glitches fix
2015-04-29 13:17:17 +02:00
Andrea Bogazzi
4bed22f4a9 iText clean up and style fixes 2015-04-29 08:27:56 +02:00
sapics
0e18219bda remove first start() call 2015-04-28 14:13:06 +09:00
Juriy Zaytsev
6c92681cf9 Merge pull request #2136 from sapics/fix_unit_test_shadow
Fix unit test for shadow
2015-04-23 12:40:08 +02:00
kangax
94f7035624 Lint unit tests and fix errors/warnings 2015-04-23 11:47:35 +02:00
sapics
0d23eb8c21 fix test/unit/canvas.js just remove character "c" 2015-04-22 20:37:50 +09:00
Juriy Zaytsev
3586cb26f7 Merge pull request #2141 from asturur/fixThis.Canvas
Make .canvas property always present
2015-04-22 13:17:38 +02:00
Juriy Zaytsev
54211dd349 Merge pull request #2130 from asturur/ActiveGroupSorter
Fix sortedObjects
2015-04-22 13:05:53 +02:00
Andrea Bogazzi
bd2f99b271 Update group.js 2015-04-22 06:37:49 +02:00
sapics
c15e40117c Fix unit test of shadow 2015-04-21 14:23:04 +09:00
Andrea Bogazzi
a5e9ae8372 Added test for object sorting 2015-04-21 00:45:46 +02:00
sapics
60d7495608 unit test for detect path initialize bug 2015-04-16 17:01:06 +09:00
Incuuu
4907861edb Add tests for setBackgroundImage options parameter 2015-04-07 13:38:26 +04:00
Jeff Parsons
a0a4d77272 Track IText instances per-canvas, not globally.
Previously instances of the IText shape were added to a globally-shared
array when they were created. There are two problems with this approach:

1) Interactions with one canvas affect others. I would never expect
   text in one canvas to exit edit mode just because I interacted with
   some otherwise-unrelated canvas.

2) Every IText instance leaks. There is no mechanism to clean up references
   to IText instances in the global array, so every such instance will
   hang around in memory forever, regardless of whether it is removed from
   the canvas or if the canvas itself is removed.

Discovered while profiling memory usage in Chrome.
2015-03-24 14:14:43 +11:00
Andrea Bogazzi
08a1c6b418 Fix path group toSvg method.
now respect current originX and originY
2015-03-01 23:27:17 +01:00
Juriy Zaytsev
55bc74bc4c Merge pull request #1958 from asturur/Fix-svg-tiny-test-suite
Fixes svg rendering rules
2015-02-05 10:53:41 +01:00
asturur
6a6b74aae1 Fixes svg rendering rules 2015-02-03 14:24:11 +01:00
Juriy Zaytsev
3b54fd031d Merge pull request #1951 from asturur/transformMatrix-for-pathgroup
Fixes for path-group transformMatrix in svg export
2015-01-28 13:41:15 +01:00
Andrea Bogazzi
0523352dfa Fix pathGroup TransformMatrix
solves missing transformMatrix
2015-01-28 12:41:09 +01:00
Juriy Zaytsev
5903c23634 Merge pull request #1872 from asturur/itext-rendering
text rendering changes
2015-01-27 16:10:09 +01:00
Andrea Bogazzi
0e09961c64 Update to text, rendering and optimization 2015-01-26 02:49:37 +01:00
Juriy Zaytsev
49d68723cb Merge pull request #1935 from asturur/shoadow2
Missing space was breaking path single shape export.
2015-01-20 01:51:41 +01:00
Andrea Bogazzi
79d9618352 Fix single path toSVG export. 2015-01-20 01:49:16 +01:00
Andrea Bogazzi
6605880f4b Update shadow.js 2015-01-18 17:29:37 +01:00
Juriy Zaytsev
f125941e21 Merge pull request #1825 from asturur/Line-tests
Line accuracy issue in pathgroup with high zoom level
2014-11-22 14:26:01 +01:00
Andrea Bogazzi
f4385b2de9 Fix line accuray issue, remove some duplicate code, do not force width = 1 on 0. Fix object render method to render 0-dimensions lines
Check how this version could behave in general rendering.
2014-11-20 22:34:47 +01:00
Juriy Zaytsev
efbb3e40b3 Merge pull request #1770 from asturur/fix-text-toSVG
Fix text top position in svg export
2014-11-05 18:53:38 +01:00
Juriy Zaytsev
8f0b9055b1 Merge pull request #1788 from asturur/Some-text-goodies
Some text goodies
2014-10-29 11:41:39 +01:00
Andrea Bogazzi
552c6a833c Update text.js 2014-10-28 17:12:10 +01:00
Andrea Bogazzi
7725227d44 Update text.class.js
fix text top position in svg export
2014-10-26 22:51:26 +01:00
Andrea Bogazzi
b9f37586b3 Update text.js 2014-10-26 22:42:55 +01:00
Andrea Bogazzi
4054b99fe5 Update group.js 2014-10-21 12:18:14 +02:00
Andrea Bogazzi
cf6030d9db Update group.js 2014-10-20 18:11:25 +02:00
Andrea Bogazzi
9ebd84bd39 Update group.js 2014-10-20 17:28:26 +02:00
Juriy Zaytsev
d1ba16f177 Merge pull request #1720 from asturur/Image-aspec
preserve Aspect Ratio for images support
2014-10-16 18:04:31 +02:00
Andrea Bogazzi
49f449ee4f Update image.class.js 2014-10-11 21:56:38 +02:00
Juriy Zaytsev
77183cb2d2 Merge pull request #1731 from asturur/fix-travis
Block qunit version to 0.7.2 to fix Travis hanging.
2014-10-07 11:21:04 +02:00
Andrea Bogazzi
e5e1aef378 Update parser.js
Fix parser test after change in skew matrix.
We should think about using  some toFixed with number of decimals ( 6 at least ? )
2014-10-07 10:58:44 +02:00
Juriy Zaytsev
c4df8b4689 Merge pull request #1714 from asturur/fix-lines
Fix for line toObject method.
2014-10-06 00:27:17 +02:00
Andrea Bogazzi
ebe4bd7286 Update line.class.js 2014-09-30 23:13:34 +02:00
Juriy Zaytsev
7f3f43c94b Merge pull request #1699 from asturur/Ellips-rx-ry
Update ellipse.class.js
2014-09-29 08:41:37 +02:00
Andrea Bogazzi
d0de45e11a Update ellipse.class.js
Mirrored from circle the way it updates width and height following rx and ry of ellipse.
2014-09-29 00:05:04 +02:00
Andrea Bogazzi
b2e2767053 Update getCssRule to exit on empty styles tag.
Test unit added.
2014-09-27 20:05:39 +02:00
Andrea Bogazzi
10666e9006 Update parser.js 2014-09-26 14:03:11 +02:00
Juriy Zaytsev
e524c13521 Merge pull request #1638 from joerozek/stacking
Support for preserving object stacking. Closes #1636.
2014-09-25 13:32:03 +02:00
Andrea Bogazzi
00a442b028 exit from getSvgTransform just for pathGroups.
Fix Svg Export for normal canvas group
2014-09-25 11:05:39 +02:00
Andrea Bogazzi
af1138a686 Divided FillRule from globalCompositeOperation 2014-09-23 08:53:56 +02:00
Andrea Bogazzi
18a23cf690 Update parser.js 2014-09-21 01:16:59 +02:00
Juriy Zaytsev
e9f310c2ce Merge pull request #1680 from asturur/Fix-Path-BoundingBox
Fix Path bounding box, improve rendering logic
2014-09-19 12:36:58 +02:00
Andrea Bogazzi
0a6600ecb7 Update path.js 2014-09-18 14:54:36 +02:00
Andrea Bogazzi
0a958de01e Update canvas_static.js 2014-09-18 14:54:16 +02:00
Andrea Bogazzi
8aae7dec4a Update canvas.js 2014-09-18 14:53:08 +02:00
Andrea Bogazzi
2f1b412f32 Update circle.js
Added start and end Angle to tests.
2014-09-18 01:34:32 +02:00
Joe Rozek
d2b146c21c support for preserving object stacking 2014-09-04 12:01:48 -07:00
Andrea Bogazzi
c1bd4ea4a3 Update polyline.js 2014-09-03 22:40:45 +02:00
Andrea Bogazzi
2e6fb2c411 Update polygon.js 2014-09-03 22:39:54 +02:00
Andrea Bogazzi
a9e2211780 Update gradient.js 2014-08-16 08:16:12 +02:00
Juriy Zaytsev
4c7ad6a82d Merge pull request #1567 from asturur/SVG-EXPORT
Better SVG export
2014-08-07 20:42:56 +02:00
Juriy Zaytsev
4bcfef6277 Merge pull request #1557 from asturur/gradient-transform-impor
attribute gradientTransform import
2014-08-06 16:49:06 +02:00
Andrea Bogazzi
3064d5e569 Updated test for text 2014-08-05 13:22:12 +02:00
Andrea Bogazzi
0538fe68c9 Fixes tests for rects 2014-08-05 13:19:53 +02:00
Andrea Bogazzi
78a5221143 Mirrored tests from polygons 2014-08-05 13:19:07 +02:00
Andrea Bogazzi
c5a5ce3ce9 fixed differences for new transforms 2014-08-05 13:16:12 +02:00
Andrea Bogazzi
99cb87bfca fixes test for ellipses 2014-08-05 13:15:10 +02:00
Andrea Bogazzi
d2da5956cd fix tests for circle 2014-08-05 13:11:59 +02:00
Andrea Bogazzi
8500f28f8f removed x and y no more used for rect 2014-08-05 13:08:40 +02:00
Andrea Bogazzi
491b4d1c33 Fixed test for rect, x and y are no more used. 2014-08-05 13:07:01 +02:00
Jim Rodovich
9b74583532 fabric.Polygon.fromElement() shouldn't throw an error.
It can just return `null`.
2014-08-04 15:40:02 -05:00
Andrea Bogazzi
b27cba8921 Update gradient.js
Add test for imported transform
2014-08-03 20:55:04 +02:00
Bnaya Peretz
f7fa1a874a tests 2014-07-31 18:19:19 +03:00
Andrea Bogazzi
78561cc257 Update parser.js 2014-07-26 19:34:30 +02:00
Andrea Bogazzi
4d74abaa53 Update parser.js 2014-07-26 19:19:59 +02:00
asturur
93aafb9d7a Update parser.js
modified test.
2014-07-21 06:48:49 +02:00
asturur
6ceb1123b6 Update util.js 2014-07-18 19:54:50 +02:00
asturur
c346d297ad Update util.js
Any svg return a pathgroup
2014-07-18 19:43:42 +02:00
asturur
ddbcb47d23 Update text.js
So tests don't fail.
2014-07-18 18:03:21 +02:00
kangax
17bf29616d Try fixing char width for travis again 2014-07-18 14:43:54 +02:00
kangax
7de2aedf7c Try fixing char width for travis again 2014-07-18 14:33:50 +02:00
kangax
3e294fee94 Try fixing char width for travis 2014-07-18 14:27:25 +02:00
kangax
3df3c396a2 Fix unit tests 2014-07-18 13:11:18 +02:00
kangax
da0037447b Change height in itext test 2014-07-18 12:19:51 +02:00
Stefan Kienzle
306a040fef Fix initialization of viewportTransform array
Add unit tests
JSDoc tweaks
2014-07-17 13:28:55 +02:00
Paul Kaplan
a1cde528dc Add test for whitespace between commas 2014-07-14 09:57:14 -05:00
asturur
a95897313f Update object.js
i need bigger spacebar.
or better i need to stick something on comma key that press even space after it.
Something that can bend down in one direction but not in the other, so when i press comma it push spacebar down, and when i press spacebar i don't fire a comma!
2014-06-24 15:34:18 +02:00
asturur
62d281bd3d Update object.js
I'm not sure, i'm sorry i tried to guess.
2014-06-24 14:12:39 +02:00
Jim Rodovich
7d0c9ebb28 Add spec for multiple M/m commands being preserved.
This wasn't ever broken, but taken with the previous spec it makes more clear that there's a difference between `M 1,2 3,4` and `M 1,2 M 3,4`.
2014-06-06 10:37:24 -05:00
Jim Rodovich
ac095b9bd7 Add spec for multiple M/m coordinates being converted to L/l. 2014-05-30 10:16:02 -05:00
Stefan Kienzle
cbf59d577c JSON object without "objects" property throws "TypeError: Cannot read property 'length' of null" - Should now be fixed.
Add unit test.
Closes issue #1235
2014-05-13 13:32:55 +02:00
Stefan Kienzle
e0ee99caa4 Initialize "Noise" and "Brightness" filter with 0 instead of 100.
Closes issue #1257
2014-05-12 16:44:12 +02:00
kangax
9b964b7fbf Fix unit tests 2014-05-12 11:23:48 +02:00
kangax
87b0f2da35 Add support for transparent value in fabric.Color 2014-05-09 22:55:33 +02: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
849cfde78d Add test for parsing numbers with no digits before the decimal point. 2014-05-08 14:08:17 -05:00
Jim Rodovich
63fa09e8ee Update unit tests to use degrees for imported SVG rotations. 2014-05-08 13:53:00 -05:00
Ross Wilson
2c8641ff6d test build 2014-04-21 11:29:18 -06:00
Ross Wilson
89f784d27f Update test for fix of #1237 2014-04-21 11:13:26 -06:00
kangax
c8164959c8 Add support for SVG "visibility: hidden" 2014-04-16 14:05:34 -04:00
kangax
d6a73aa7f5 Make isSameColor cave-insensitive. Closes #1272 2014-04-14 12:17:06 -04:00
Anders Lisspers
f5ba67541e Adds test case for rgba percentages with decimals 2014-02-27 10:19:42 +01:00
XhmikosR
d8b1eca014 Trim trailing spaces. 2014-02-23 20:16:20 +02:00
Maciej Filip Szkodziński
7d72d0500f Removed Line._getCenterToCenter helpers
Pre-rendering context translation for lines in path-groups uses the
pre-existing getCenterPoint.

Removed tests for removed code.
2014-02-05 17:33:20 +01:00
Maciej Filip Szkodziński
df764728e0 Fix group mocks in Line tests
Added missing semicolons in tests.

Refactored Line centerToCenterGetter to improve readability.
2014-02-05 17:07:45 +01:00
Maciej Filip Szkodziński
6b1e144c44 Line coordinates are correct
fabric.Line._setWidthHeight was assigning left and top as if both
origins were 'center'.

It now uses private helper methods to calculate the distances from
left and top edges of canvas to the line origins.

The data for existing Line.toObject test is updated with origin-relative
coordinates.

Rendering of line inside a path-group was assuming a 'center' origin
for both coordinates.

Context translation done before rendering for lines inside path-groups
now uses private helper methods to calculate distances from the center
of path-group to center of line.
2014-02-05 15:42:52 +01:00
Kienz
61f65bc206 Fix path regExp for compressed path commands
Fix regExp for e^x numbers
Add unit test for e^x numbers
2014-01-12 13:50:03 +01:00
kangax
448dfad97e Fix unit tests 2014-01-04 15:02:51 -05:00
kangax
ea811cbb23 Fix fabric.Path#path being "cloned" by reference 2013-12-31 09:29:14 -05:00
kangax
dbd9193703 Debounce element parsing. Thanks @biovisualize. Closes #1052 2013-12-14 12:19:54 +01:00
Kienz
fd3ace05bb [BACK_INCOMPAT] Possibility to remove multiple fabric.Objects from collection (canvas, group) - this (canvas, group or object) is returned instead of delete object
Update unit tests - use strictEqual for some cases
Add multiple objects raised `object:added` for last added object first - now 1st added object raises 1st `object:added` event, 2nd object raises 2nd `object:added`…
2013-12-07 11:07:46 +01:00
kangax
b189645bba Fix unit test 2013-11-25 21:57:32 +01:00
kangax
ae11740f82 Fix i-text style copy-pasting (doesn't work with multiline yet) 2013-11-25 21:32:00 +01:00
kangax
f84ac95f75 fix test 2013-11-25 16:53:31 +01:00
kangax
4950e35627 Add remaining i-text unit tests 2013-11-25 16:39:50 +01:00
kangax
1075ed0851 Even more i-text unit tests 2013-11-23 19:33:48 +01:00
kangax
58464d4773 More i-text unit tests 2013-11-23 19:28:12 +01:00
kangax
3abe2f74f3 Add expect(0) 2013-11-23 17:49:21 +01:00
kangax
854d428c38 Add more tests 2013-11-23 17:35:31 +01:00
kangax
82509dc8d8 More IText tests 2013-11-23 13:45:53 +01:00
kangax
673fa39eba Start adding i-text unit tests; add additional util and color tests 2013-11-22 17:30:55 +01:00
Kienz
d4b2ea18b7 Fix center methods for object’s with different originX/originY
object.center() only re-renders canvas once instead of twice
Update unit tests
2013-11-20 20:41:13 +01:00
Kienz
67fd4253f3 Fix unit tests 2013-11-20 19:47:30 +01:00
kangax
ffe6091dd7 Move getObjects to fabric.Collection. Add support for getObjects(type). Version 1.3.10. 2013-11-09 14:50:30 +01:00
Kienz
42935be697 Remove activeObject in fabric.Canvas#remove
Fire 'before:selection:cleared' and 'selection:cleared' if activeObject is removed from canvas
Add unit test

Fixes issue #962
2013-11-08 19:09:16 +01:00
kangax
d0abb90f1c Add fabric.Image#crossOrigin which allows crossOrigin image loading and canvas rendering without tainting. fabric.util.loadImage now accepts 4th argument (crossOrigin) and sets crossOrigin="" on image element by default. fabric.Image.fromURL can be passed crossOrigin via 3rd argument (options). Closes #263 2013-11-05 15:13:15 +01:00
Juriy Zaytsev
fe54615584 Merge pull request #931 from lorenzopolidori/controls-visibility
Added object controls visibility. Closes #552.
2013-11-03 15:28:19 -08:00
kangax
330784ac2c [BACK_INCOMPAT] Change default objects' originX/originY to left/top 2013-11-04 00:15:49 +01:00
Lorenzo Polidori
d1642c0729 Added object controls visibility (github issue #552). 2013-11-03 23:08:05 +00: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
Kienz
6f115bbf1e Fix fabric.util.enlivenObjects for empty fabric.Group objects
Add unit test
Fixes issue #943
2013-11-02 16:02:38 +01:00
kangax
c6ff46269c Preserve canvas reference in fabric.Object#toDataURL. Closes #938 2013-10-31 16:00:31 +01:00
Alex Chuchunkov
a6f8e16c81 stopObserving w/o arguments removes all event - handler pairs. Closes issue #936 2013-10-29 22:47:29 +04:00
kangax
ae5973676a Support includeDefaultValues in shadow serialization 2013-10-25 09:05:39 +02:00
Kienz
14d053e9b2 Fix unit test 2013-09-29 10:21:55 +02:00
Kienz
be86429b32 Add reviver function to fabric.Canvas.toSVG.
Reviver function accepts one parameter (svg string representation of object instance) and should return svg string.
Add qunit test.
2013-09-29 09:22:44 +02:00
kangax
f2ad6e5be6 [BACK_INCOMPAT] Move "backgroundColor" from fabric.Text to fabric.Object (only works with text for now). Remove fabric.Object#overlayFill. Remove fabric.Canvas.toGrayscale, fabric.Object#toGrayscale, and fabric.Object#overlayFill. Version 1.3.5 2013-09-28 23:47:53 +02:00
kangax
83ca60e885 Fix resolveNamespace and getKlass on node 2013-09-24 13:25:38 +02:00
Kienz
cabc63c633 Fixed unit test 2013-09-20 22:38:37 +02:00
Stefan Kienzle
60e9d0f144 [BACK_INCOMPAT] Initialization of fabric.Image.filters.Tint is now different - options.color: color string value, options.opacity: 0..1
Now you can define opacity of the tint filter (by rgba/hsla colors or with opacity attribute)
Doc additions
2013-09-20 19:51:55 +02:00
Kienz
cb510b9ef3 Fixed fabric.Group.toSVG- object order was wrong 2013-09-18 19:17:50 +02:00
kangax
408a8b9de6 Alias "jpg" format to "jpeg". Closes #806 2013-09-14 18:44:44 +02:00
Kienz
26e784aede Move setColorfrom fabric.Text to fabric.Object
Fixed "enum" notation
`fabric.Object.setGradient` is now chainable
Doc additions
Add `fabric.Object.setPatternFill`unit test
Add chainable tests to some methods
2013-09-14 17:10:49 +02:00
Juriy Zaytsev
a7489774fd Merge pull request #840 from Kienz/patch-2
`fabric.Observable.on` and `fabric.Observable.off` can add/remove multiple handlers (object with key/value pairs). Closes #838
2013-09-12 14:49:31 -07:00
Kienz
1e1adc7831 fabric.Observable.on and fabric.Observable.off can add/remove multiple handlers (object with key/value pairs)
Update jsdoc
Add unit tests
2013-09-12 20:43:31 +02:00
Kienz
9f6dea5d9e Add reviver function to fabric.Canvas.loadFromJSON (and loadFromDatalessJSON)
Add unit test
2013-09-12 20:10:23 +02:00
kangax
5ebd697978 [BACK_INCOMPAT] Remove selectable, hasControls, hasBorders, hasRotatingPoint, transparentCorners, perPixelTargetFind from default object/json representation of objects. Fix includeDefaultValues. Version 1.2.13. Closes #795 2013-09-11 11:41:00 +02:00
Stefan Kienzle
d190c31e8b Renamed fabric.Shadow.getShadow to fabric.Shadow.toString 2013-09-05 18:09:34 +02:00
Juriy Zaytsev
ed1c116793 Merge pull request #823 from Kienz/patch-1
[BACK_INCOMPAT] `fabric.Text.textShadow`was removed and `fabric.BaseBrush` shadow properties removed (new `fabric.BaseBrush.shadow`)
2013-09-03 12:27:13 -07:00
kangax
4559918688 Resolve conflicts 2013-09-03 21:18:29 +02:00