Commit graph

1390 commits

Author SHA1 Message Date
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
GordoRank
02d55954e9 Move check into separate function 2014-01-27 12:29:30 +00:00
kangax
f928e68386 Few small tweaks 2014-01-26 22:19:12 -05:00
mizzack
bed0cab833 Adding nullcheck to touches attr on event.
This was throwing errors in IE11 on desktop.  Not that it needs gesture support...
2014-01-26 15:36:31 -05:00
GordoRank
88157a8107 Optimize searchPossibleTargets 2014-01-24 09:44:08 +00:00
kangax
e977372236 Remove node 0.6 from travis until jsdom fixes it 2014-01-23 11:25:04 -05:00
kangax
3dd2f1572d Move for in body into a separate method (to allow inlining) 2014-01-23 10:49:23 -05:00
kangax
dbbfb992cb Add all properties onto prototype (not to invalidate hidden classes) 2014-01-23 10:49:23 -05:00
GordoRank
531faae418 revert master 2014-01-23 10:15:30 +00:00
GordoRank
4183bddd26 revert 2014-01-23 10:14:58 +00:00
GordoRank
235f7add81 update cache in setElement() 2014-01-23 10:08:49 +00:00
GordoRank
c8da9fbfc3 update cache automatically in _set() 2014-01-23 10:07:33 +00:00
Juriy Zaytsev
b600c39119 Merge pull request #1112 from GordoRank/Add-textselected-event
Add "text:selection:changed" event
2014-01-22 21:48:36 -08:00
GordoRank
b75fa8c32d switch to 'text:selection:changed' 2014-01-23 01:32:08 +00:00
GordoRank
f6108963b2 switch to 'text:selection:changed' 2014-01-23 01:31:20 +00:00
Juriy Zaytsev
9f0f5e6bd2 Merge pull request #1111 from GordoRank/Only-add-hidden-textarea-when-in-editing-mode
Prevent multiple hidden Textareas
2014-01-22 16:44:36 -08:00
Juriy Zaytsev
c9a27eb6a0 Merge pull request #1110 from GordoRank/Fix-multiple-renderAll-when-exiting-editing-mode
Fix multiple renderAll when exiting editing mode
2014-01-22 16:36:25 -08:00
GordoRank
4631a8929a Update itext.class.js 2014-01-20 20:59:04 +00:00
GordoRank
ab67a7d1d6 Update itext.class.js 2014-01-20 15:28:50 +00:00
GordoRank
394732f3a3 Update renderCursor/renderSelection
Update renderCursor()/renderSelection() to draw to separate canvas
2014-01-20 14:54:41 +00:00
GordoRank
e3dd37ff22 remove IText _render()
The ```the _render()``` method for IText objects is no longer needed when since rendering cursor/selection is now handled elsewhere
2014-01-20 14:51:21 +00:00
GordoRank
40b04c7b11 Let _getWidthOfChar() return cached values 2014-01-20 11:19:01 +00:00
GordoRank
e000ed0ef0 Remove clashing 'selected' event firing 2014-01-20 09:43:36 +00:00
GordoRank
cec2a17a47 Remove clashing 'selected' event firing 2014-01-20 09:43:00 +00:00
GordoRank
8cf567522d Update itext.class.js 2014-01-20 08:50:02 +00:00
GordoRank
72e1b91ee4 Reduce calls to fillText/fillStroke in IText 2014-01-20 08:42:24 +00:00
GordoRank
764b55ed33 Fire text:selected on selectAll 2014-01-20 08:22:02 +00:00
GordoRank
3e1433acb1 Add text:selected event 2014-01-20 08:21:00 +00:00
GordoRank
9a2d697cf2 Prevent multiple hidden Textareas
Currently a hidden ```TEXTAREA``` is created for every IText instance and remain in the DOM forever.  

This patch creates the required textarea on demand in ```enterEditing``` and destroys it in ```exitEditing```

This prevents multiple Textareas from hanging around in the DOM which can cause slowdowns in complex scenes with lots of IText instances.
2014-01-20 08:14:31 +00:00
GordoRank
b814568294 Prevent multiple RenderAll calls on exit edit
This commit modifies the ```mouseUp ```handler to fix ```enterEditing``` behaviour, while maintaining the ability to fire ```enterEditing()``` programmatically
2014-01-20 07:46:59 +00:00
GordoRank
564266e3e2 Prevent multiple RenderAll calls on exit edit
This fix prevents ```renderAll()``` being called for each IText instance when ```exitingMode``` is exited.  Only one ```renderAll()``` is necessary
2014-01-20 07:42:33 +00:00
GordoRank
d088bb1fb7 Fix IText selection with varying font widths 2014-01-20 07:28:33 +00:00
kangax
aa98c317b7 Fix keyboard appearance on Android. Closes #1070 2014-01-18 16:08:41 -05:00
kangax
f1aef7ed1a Version 1.4.3 2014-01-18 12:01:19 -05:00
kangax
bc8acac692 Only call _renderStroke in line and circle when this.stroke exists 2014-01-17 11:57:54 -05:00
kangax
20e0712688 Avoid set in fabric.Line#_setWidthHeight 2014-01-17 11:57:31 -05:00
kangax
727a8d04b1 Move _hasITextHandlers to canvas instance 2014-01-17 11:51:36 -05:00
kangax
13fcf15b8b Make sure compiler can inline 2014-01-17 11:51:16 -05:00
kangax
16447f9b7a Optimize _renderObjects to take fast path if no activeGroup given 2014-01-17 11:48:17 -05:00
kangax
4761c2527c Build distribution 2014-01-14 12:57:13 -05:00
Juriy Zaytsev
7094ec47e2 Merge pull request #1094 from anvaka/fixNodeCanvas
createCanvasForNode passes options to FabricCanvas
2014-01-14 09:51:55 -08:00
Juriy Zaytsev
d4ea2c6f1e Merge pull request #1097 from GordoRank/master
Rewrite renderSelection to only draw once per line
2014-01-14 09:46:16 -08:00
GordoRank
0abc547d6b Fixed formatting and cache start.lineIndex 2014-01-14 17:37:40 +00:00
kangax
166dc60716 Fix JSHint warnings, build distribution 2014-01-14 12:34:32 -05:00
GordoRank
9f2c678a66 Formatting fixed and end.lineIndex cached 2014-01-14 17:23:40 +00:00
GordoRank
350261437a Rewrite renderSelection to only draw once per line
Previously RenderSelection performed a fillRect() command for every character.  This resulted in poor performance on large bodies of text.  This rewrite calculates the selection box for each line of text and draws a single rectangle for each line, dramatically improving performance.
2014-01-14 17:09:19 +00:00
GordoRank
90a97e6272 Fix click cursor placement on center/right text
This clamps the click cursor placement so that clicking to the left of a short first line of centered/right aligned text positions the cursor to the left of the first character in the line....

Previously in that instance it would move to the left boundary instead
2014-01-14 15:48:59 +00:00
GordoRank
77f304bed0 Fixes Center/Right aligned cursor placement
Fixes Center/Right aligned cursor placement by mouse click when the text box is scaled
2014-01-14 13:58:06 +00:00
GordoRank
272859b8f1 Formatting fixes 2014-01-14 11:03:27 +00:00
GordoRank
1e9c58ea01 formatting fixes 2014-01-14 11:00:48 +00:00
GordoRank
a7e0e681d5 Formatting fixes 2014-01-14 10:56:43 +00:00
anvaka
6486606670 createCanvasForNode passes options to FabricCanvas
Some options like renderOnAddRemove plays crucial role in canvas
performance. This change allows clients to use custom options for
node.js
2014-01-14 01:12:29 -08:00
GordoRank
a2cf96a020 Dblclick at end of word selects previous word
Fixes selectWord so that double clicking at the end of a word (just after the last character in the left half of the space) selects the previous word.  Again this is MS Word behaviour.
2014-01-14 00:25:42 +00:00
GordoRank
1499baa7c3 Move enterEditing back into MouseUp
Oops... thats better! :)

This way we get all the responsiveness benefits of setting the cursor position on mousedown but can still actually move the objects!
2014-01-14 00:00:25 +00:00
GordoRank
ec144b773d Set cursor restart delay to 0
Setting cursor restart delay to 0 improves responsiveness when beginning drag selection, works inline with my previous two commits for selectLine/selectWord
2014-01-13 23:32:22 +00:00
GordoRank
8cb74e00e2 Restart cursor on selectWord/selectLine
Restarting cursor rendering using initDelayedCursor(true) in selectWord and selectLine improves user perceived responsiveness and provides an accurate reproduction of MS Word behaviour
2014-01-13 23:19:18 +00:00
GordoRank
2c5c83f9da Moved enterEditing into MouseDown
MS word appears to move the caret on MouseDown, not on MouseUp as I thought.
2014-01-13 23:09:12 +00:00
GordoRank
2539c68cc8 Do not rely on options object in enterEditing #2 2014-01-13 22:43:58 +00:00
GordoRank
ead81813bd Do not rely on options object for enterEditing #1 2014-01-13 22:42:29 +00:00
GordoRank
6acb697b7a Fix more formatting 2014-01-13 22:27:25 +00:00
GordoRank
b8c83ed242 Fix formatting 2014-01-13 22:22:40 +00:00
GordoRank
cc52bf7039 rename __lastEditing to __lastIsEditing 2014-01-13 22:19:44 +00:00
GordoRank
3510004d97 Set cursor to mouse position on editing enter 2014-01-13 12:13:19 +00:00
GordoRank
0957c9ca9f Set cursor position to mouse click on enter 2014-01-13 12:12:12 +00:00
GordoRank
55bc6a990b Make flashing cursor behave like MSWord 2014-01-13 12:04:46 +00:00
GordoRank
3582fd3ba9 Make flashing cursor behave like MSWord 2014-01-13 11:58:26 +00:00
GordoRank
f56be28052 Make flashing cursor behave like MSWord 2014-01-13 11:56:56 +00:00
GordoRank
f7e24da770 Click after line should set cursor to this line
Clicking past the end of line selects the last character of that line
2014-01-13 10:19:39 +00:00
GordoRank
b6fb6491bc Dbl click into editing mode sets cursor position
Double click directly into editing mode sets cursor position rather than selects whole word
2014-01-13 09:29:56 +00:00
Juriy Zaytsev
2b74c2abc5 Merge pull request #1087 from Kienz/patch-1
Fix fabric.Canvas initialization for width/height attributes. Closes #1086
2014-01-12 06:38:07 -08:00
Juriy Zaytsev
bb7f52cc84 Merge pull request #1088 from Kienz/patch-2
Fix path regExp for compressed path commands
2014-01-12 06:37:46 -08:00
Kienz
da0866429a Initialize fabric.IText canvas handlers only once. Closes #1076
Qunit additions
2014-01-12 15:32:50 +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
Kienz
50899a79ef Fix fabric.Canvas initialization for width/height attributes. Closes #1086. 2014-01-12 11:33:42 +01:00
kangax
c5f97d69af Remove console.log in itext 2014-01-04 15:02:51 -05:00
kangax
92b0d5e282 Optimize rendering of 1x1 rectangles 2014-01-04 15:02:51 -05:00
kangax
d7c2076b8a Do not call shadowColor = ... when there's no shadow 2014-01-04 15:02:51 -05:00
kangax
e0aed05c3d Build distribution 2013-12-31 09:29:14 -05:00
kangax
ea811cbb23 Fix fabric.Path#path being "cloned" by reference 2013-12-31 09:29:14 -05:00
Stefan Kienzle
6776e62d00 Fix overlayImage / overlayColor during selection mode. Closes #1068 2013-12-27 10:19:57 +01:00
kangax
7c541da8cc Fix double callback in loadFromJSON if objects.length == 0. Closes #1056 2013-12-21 15:17:08 +01:00
mizzack
d13a4dd273 Correcting invalid control name 2013-12-19 11:02:23 -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
d478482a19 Fix number parsing in paths. Closes #961 2013-12-18 11:29:44 +01:00
kangax
ec629c6b59 Update text events 2013-12-18 11:28:06 +01:00
kangax
032cc05bd1 Fix background offset in iText. Closes #1029 2013-12-14 14:55:47 +01:00
kangax
63eb873e7f Fix style object deletion in iText. Closes #1035 2013-12-14 12:25:04 +01:00
kangax
dbd9193703 Debounce element parsing. Thanks @biovisualize. Closes #1052 2013-12-14 12:19:54 +01:00
kangax
4a8c457680 Fix typo in _initCanvasHandlers. Closes #1048 2013-12-14 12:04:26 +01:00
kangax
79b4474e77 Mention that itext supports ctrl/cmd+a 2013-12-14 12:04:26 +01:00
kangax
db041fded5 Add note about clipTo origin. Update changelog 2013-12-11 11:09:59 +01:00
kangax
8d8cd16f6c Add "mouse:over" and "mouse:out" events 2013-12-09 15:35:08 +01:00
Nazar Mokrynskyi
38bed8143e New events:
* object:over
* object:out
* mouseover
* mouseout

Based on demo example
2013-12-08 18:01:48 +02:00
kangax
37afbc2909 Fix transformMatrix not affecting text. Closes #1031 2013-12-07 13:59:38 +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
Tom French
3cc191bdfb Fixed control and group selection rendering 2013-12-06 13:40:17 +00:00
Tom French
b0e944c251 Merge branch 'master' of https://github.com/kangax/fabric.js
Conflicts:
	dist/all.require.js
2013-12-05 19:46:47 +00:00
Tom French
ce4809d1e8 Merge branch 'master' of https://github.com/kangax/fabric.js
Conflicts:
	dist/all.js
	dist/all.require.js
	src/brushes/circle_brush.class.js
	src/brushes/spray_brush.class.js
	src/canvas.class.js
	src/mixins/canvas_events.mixin.js
	src/mixins/object_interactivity.mixin.js
	src/shapes/group.class.js
	src/shapes/image.class.js
	src/shapes/object.class.js
	src/util/misc.js
2013-12-05 19:45:39 +00:00
kangax
596831b6c1 Fix itext editing exit when clicking on other objects. Closes #1019 2013-11-29 14:43:01 +01:00
kangax
56f0bfb9cc Avoid setting crossOrigin on an image if unspecified. Closes #971 2013-11-27 20:00:33 +01:00
kangax
0f23f14a44 Add fabric.IText#caching 2013-11-27 19:48:35 +01:00