Commit graph

1390 commits

Author SHA1 Message Date
Jim Rodovich
1201cfb1e1 Make closepath commands update current x/y coordinates.
Per the SVG spec,
> If a "closepath" is followed immediately by any other command, then
> the next subpath starts at the same initial point as the current
> subpath.
2014-06-06 13:50:54 -05:00
Tom French
8c826a3204 Fixes for controlsAboveOverlay 2014-06-06 17:36:17 +01:00
Jim Rodovich
ff04efdc76 Don't ever draw lines to explicit M/m commands.
#1365 converted multiple M/m coordinates to L/l commands when importing paths. The `_render` function was already attempting to connect those coordinates, but that's no longer necessary as the only consecutive M/m commands in `_render` were explicitly defined as M/m commands.
2014-06-06 10:31:54 -05:00
Kienz
c258b08f48 Add IE support for copy / paste events
Fix for `cut` event if nothing is selected
2014-06-05 00:56:34 +02:00
Stefan Kienzle
41933ccf20 Merge pull request #1348 from Kureev/copy/paste
Copy/Paste from/to external resources
2014-06-05 00:45:17 +02:00
Tom French
ef01083cab Stray console.log removed. 2014-06-03 08:36:00 +01:00
Kureev Alexey
09836dc2c7 Copy/paste old browsers support check 2014-06-01 21:51:41 +02:00
Tom French
009c5389bf JSHint, restoring .gitignore 2014-05-31 18:08:33 +01:00
Tom French
b4746e6bf2 Merge remote-tracking branch 'upstream/master' 2014-05-31 17:33:28 +01:00
Tom French
0d8db88e71 Merge remote-tracking branch 'upstream/master'
Conflicts:
	.gitignore
	dist/fabric.js
	dist/fabric.require.js
	src/brushes/circle_brush.class.js
	src/canvas.class.js
	src/mixins/canvas_events.mixin.js
	src/mixins/object_geometry.mixin.js
	src/mixins/object_interactivity.mixin.js
	src/shapes/group.class.js
	src/shapes/image.class.js
	src/shapes/object.class.js
	src/shapes/path_group.class.js
	src/shapes/text.class.js
2014-05-31 17:29:55 +01:00
Jim Rodovich
6f8444c86a Convert extra "moveto" coordinates to "lineto" commands.
Per the [SVG spec](http://www.w3.org/TR/SVG11/paths.html#PathDataMovetoCommands):

> If a moveto is followed by multiple pairs of coordinates, the
> subsequent pairs are treated as implicit lineto commands. Hence,
> implicit lineto commands will be relative if the moveto is relative,
> and absolute if the moveto is absolute."
2014-05-30 10:08:03 -05:00
Jim Rodovich
7e8dc3a91f Fix slow clicks (> 100 ms) focusing previously-deselected IText. 2014-05-27 15:44:58 -05:00
Kureev Alexey
741e8cf43d Copy/Paste from/to external resources 2014-05-25 18:15:54 +04:00
Stefan Kienzle
a2512b2cd0 Fix IText canvas handler initialization 2014-05-22 10:48:02 +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
Matt Harrison
bfb33fb1f7 Removed 'return this', not needed for private method 2014-05-15 15:18:37 +01:00
Matt Harrison
b7f03b8a6c Added smoothing option on fabric.StaticCanvas to support setting imageSmoothingEnabled 2014-05-14 09:05:15 +01: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
Juriy Zaytsev
91c32d89a7 Merge pull request #1323 from Kienz/issue-1257
Initialize "Noise" and "Brightness" filter with 0 instead of 100
2014-05-12 20:50:49 +02:00
Kienz
5ea264ae3d fabric.Object.setAngle consider different originX/originY values other than "center"
Closes issue #1093
2014-05-12 20:36:59 +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
yuri
99a3a77267 Added Multiply filter 2014-05-12 00:39:02 +03:00
kangax
f5691b4b4f Set default originX as center. Closes #974 2014-05-09 23:29:11 +02:00
kangax
87b0f2da35 Add support for transparent value in fabric.Color 2014-05-09 22:55:33 +02:00
Juriy Zaytsev
916b35b93d Merge pull request #1314 from rodovich/round-rect-arcs
Use a cubic bezier approximation for rounded rectangle corners.
2014-05-09 00:32:41 +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
6a478e6791 Use a cubic bezier approximation for rounded rectangle corners.
According to the SVG spec these corners are supposed to be elliptical arcs.  HTML canvas does not have methods for elliptical arcs, but a cubic approximation can get within 0.02%.

Using the "magic number" from http://itc.ktu.lt/itc354/Riskus354.pdf.
2014-05-08 14:20:13 -05: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
Jim Rodovich
76314abd95 Optimize for common case of radius 0. 2014-05-07 19:02:18 -05:00
Jim Rodovich
7b4455f29a Constrain rounded rect radii to half the width & height. 2014-05-07 10:25:34 -05:00
Grzegorz Godlewski
ce786cc3ad Transform matrix and isInPathGroup fix for images 2014-04-28 21:37:52 +02:00
kangax
9113b27e77 Revert _searchPossibleTargets optimization. Closes #1188 2014-04-24 10:33:33 -04:00
Juriy Zaytsev
c7b4b52981 Merge pull request #1282 from wilsonwc/master
Fix for #1237
2014-04-22 14:28:02 -04: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
Ross Wilson
14338a9559 Fix for #1237
Only set crossorigin on the element if something is specified
2014-04-16 13:03:02 -06:00
kangax
c8164959c8 Add support for SVG "visibility: hidden" 2014-04-16 14:05:34 -04:00
kangax
5e385e5ed0 Fix text offsets and size in SVG 2014-04-16 13:39:32 -04:00
kangax
f3b7884827 Add support for "evenodd" fill rule. Closes #1021 2014-04-15 20:09:01 -04:00
kangax
d6a73aa7f5 Make isSameColor cave-insensitive. Closes #1272 2014-04-14 12:17:06 -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
3e06f4127d Fix typo. Closes #1265 2014-04-09 18:02:20 -04:00
Juriy Zaytsev
63ea7b0c34 Merge pull request #1260 from Webbgaraget/toJSON-currentTransform-bugfix
Moves the resetting of _currentTransform.target inside `if (activeGroup)`-block
2014-04-08 17:03:50 -04:00
Anders Lisspers
46100b24bd Moves the resetting of _currentTransform.target inside if (activeGroup)
This solves a problem that occurred if you were transforming (moving, scaling, rotating) a single object
when toJSON()/toObject() was run.
2014-04-03 16:20:05 +02:00
Ken Thompson
fa8bd1f40b added "_this" reference for setTimeout 2014-03-27 20:49:43 -05:00
kangax
3f14a96c5a Fix multiplier<1 export 2014-03-13 20:27:42 -04:00
Dennis Eijpe
b8dec2ddf0 Fix event listeners for multi-input devices 2014-03-09 17:14:06 +01:00
Max Kaplan
54f9c0428f add spaces before { 2014-03-07 17:32:09 -05:00
Max Kaplan
fd38b8f4a4 formatting for fixes 2014-03-07 01:15:56 -05:00
Max Kaplan
6f3f1ff7c9 Fix loadFromJSON 404s breaking fabric (Image)
Prevent image 404s in Images from loadFromJSON from breaking everything
trying to get attributes of a source which is null, while passing it
upwards to allow dealing with images which failed to load outside of
Fabric.JS Issue #1079
2014-03-07 01:12:50 -05:00
Max Kaplan
f2943ef2bb Fix loadFromJSON 404s breaking fabric (Pattern)
Prevent image 404s in patterns from loadFromJSON from breaking
everything trying to get attributes of a source which is null, while
passing it upwards to allow dealing with images which failed to load
outside of Fabric.JS
2014-03-07 00:19:35 -05:00
kangax
eb919f9a04 Fix ellipse borders. Closes #1099 Thanks @xnramx 2014-03-06 19:47:55 -05:00
kangax
2acdc7e85b Fix few bracketless statements. Down to 257 failures on JSCS. 2014-02-27 15:00:42 -05:00
kangax
eb75f4b491 Restore _currentTransform.target after toJSON. Closes #1159 2014-02-27 15:00:42 -05:00
Juriy Zaytsev
e15047016d Merge pull request #1203 from Webbgaraget/allow-decimals-in-rgba-colors
Allow decimals in rgba colors.
2014-02-27 12:41:13 -05:00
Anders Lisspers
11a21f10ee Allows rgba() colors to have decimals, i.e. rgba(45.2342%, 88.2342%, 83.5%) 2014-02-27 09:17:59 +01:00
Jeff Talbot
918d4dd5de Initialize variable with the correct name that is actually used 2014-02-24 10:47:22 -06:00
XhmikosR
67e9c8829c Remove extra commas. 2014-02-23 20:25:23 +02:00
kangax
1d4356008a Revert scroll detection change. 2014-02-21 15:04:42 -05:00
kangax
52a60769ee Update docs, specifying ms. 2014-02-20 13:59:27 -05:00
kangax
8e75acf836 Expose cursorMap. Closes #1179 2014-02-19 15:26:07 -05:00
kangax
c85a33752b Fix iText stealing focus 2014-02-19 15:25:50 -05:00
kangax
0dbf03835d Fix typo, build dist 2014-02-19 14:59:50 -05:00
Juriy Zaytsev
8f2d29f5d6 Merge pull request #1172 from kreig/patch-1
fabric.Object.fillRule support using globalCompositeOperation
2014-02-19 14:44:05 -05:00
kangax
0eed619d98 Make isContainedWithinObject check for equality as well. Closes #1177 2014-02-18 17:07:37 -05:00
kangax
6798111f03 Build distribution 2014-02-18 15:14:06 -05:00
kangax
32368ecbad Fix require typo 2014-02-18 14:53:59 -05:00
Juriy Zaytsev
7ded46ce7f Merge pull request #1168 from aspectit/css-scale-new
Fix mouse handling if the canvas has been scaled via CSS.
2014-02-18 11:58:29 -05:00
Michael Sievers
3faf5f0bae Added missing semicolon 2014-02-18 13:44:02 +01:00
Michael Sievers
bd2a235b12 Move ElementsParser instance methods to prototype 2014-02-18 13:44:01 +01:00
Michael Sievers
d44bde4605 Added semicolon to satisfy jshint 2014-02-18 13:43:20 +01:00
Michael Sievers
179ad93dc5 Make ElementsParser a constructor function and create instances in fabric.parseElements 2014-02-18 13:43:19 +01:00
Michael Elsdörfer
50107b06d7 Handle missing canvas bounds information correctly.
Fixes test failure.
2014-02-18 00:17:31 +01:00
Michael Elsdörfer
dc6e53288c Also consider CSS transforms when handling mouse. 2014-02-18 00:17:31 +01:00
Michael Elsdörfer
d5f948877c Make mouse handling respect CSS scaling.
Also DRYs getPointer() calls in many places.

See #868.
2014-02-18 00:17:31 +01:00
kangax
631226d26b More JSCS fixes; down to 295 failures 2014-02-17 11:55:54 -05: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
kangax
21f573d381 Speed up getElementStyle 2014-02-16 16:36:13 -05:00
kreig
e89c9c84bd fabric.Object.fillRule support using globalCompositeOperation
Full support for the fabric.Object.fillRule option for any visual objects.
_setupFillRule(ctx) is used to set CanvasRenderingContext2D.globalCompositeOperation (from fillRule property).
_restorFillRule(ctx) restores previously saved globalCompositeOperation.
Both methods are called form the render() method, so individual blending settings for each object can be specified.
2014-02-16 19:00:53 +02:00
Michael Elsdörfer
1be7b9fee8 Fix mouse handling inside a scrollable div.
See also #870, which was incorrectly merged.
2014-02-15 03:29:22 +01:00
kangax
0460e4e248 Fix recent group addition 2014-02-11 12:47:09 -05:00
kangax
93ac070918 Make _calcBounds more flexible 2014-02-10 23:24:29 -05:00
kangax
be96d93f6e Fix group origin after toJSON 2014-02-10 21:37:47 -05:00
RG72
107dd5735f Options for node-canvas
Allowing to write pdf via node-canvas
```var canvas = fabric.createCanvasForNode(200, 200,'pdf');
..
fs.writeFile('out.pdf', canvas.nodeCanvas.toBuffer());```
2014-02-09 12:42:15 +05: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
Juriy Zaytsev
0584d94a5c Merge pull request #1138 from GordoRank/Only-add-hidden-textarea-when-in-editing-mode
Fix object onClick (previously failed change)
2014-02-04 08:16:59 -08:00
GordoRank
d665ddfe81 Fix object onClick (previously failed change)
I'm unsure how but a previous change in this pull request never merged correctly (probably still due to my inexperience with github)  Regardless, this tiny patch fixes the bug
2014-02-04 09:44:49 +00:00
Juriy Zaytsev
172a3d3da2 Merge pull request #1135 from bernardofd/prJan2014
[Fix] loadSVGFromString receives raw buffer instead of string when loading SVG file from disk
2014-02-01 11:38:12 -08:00
kangax
512b0186c8 Tweak iText after PR 2014-02-01 14:24:25 -05:00
Juriy Zaytsev
4a967b7ddf Merge pull request #1114 from GordoRank/Improve-IText-performance
Improve overall IText performance with varying styles > 1000%
2014-02-01 11:22:20 -08:00
kangax
68d4a74def Tweak few things in iText; build distribution 2014-02-01 13:18:22 -05:00
Juriy Zaytsev
93bd41f356 Merge pull request #1113 from GordoRank/Reduce-calls-to-fillText/strokeText-for-IText
Reduce calls to fillText/fillStroke in IText
2014-02-01 10:15:39 -08:00
Bernardo Figuerêdo Domingues
522a4cc1d7 Fix request_fs returns raw buffer instead of string.
Since fs.readFile returns the raw buffer if no encoding is specified, the call to loadSVGFromString would fail. This PR fixes that, transforming the buffer into string (assuming 'utf-8') encoding. For other encodings, it may garble special characters.
2014-01-30 15:34:09 -02:00
Juriy Zaytsev
213b99eb9f Merge pull request #1127 from GordoRank/Optimize-searchPossibleTargets-for-IText
Optimize searchPossibleTargets for I-text
2014-01-27 12:54:02 -08:00
GordoRank
a962b59aa7 Iterate backwards 2014-01-27 13:05:32 +00:00