Commit graph

5476 commits

Author SHA1 Message Date
Jürg Lehni
0af4c5c0f1 Introduce Curve#hasLength() as an optimized check for curve-length.
And use it where it make sense.

Relates to https://github.com/paperjs/paper.js/issues/1109#issuecomment-234352266
2016-09-20 17:59:56 -04:00
Jan
3b8d3cc47d Use Math..SQRT1_2 instead of 0.7071
Makes code easier to understand.
2016-08-31 23:29:35 +02:00
Jan
f160e74936 Use correct value for y 45 degree tangent
I got the pythagoras wrong when I wrote this. The length of the tangent vector is 1, therefore the y component is sqrt(0.5) for 45°. This will not make any difference, but still we should use the correct value.
2016-08-31 10:05:47 +02:00
Jürg Lehni
cecd95e039 SVG: Correctly handle multiple sequential move commands.
Closes #1134
2016-08-07 21:36:03 +02:00
Jürg Lehni
0396446c4c Boolean: Clean up previous fix. 2016-08-07 15:55:27 +02:00
sapics
31690cb6b6 Fix to remove named layer 2016-08-06 11:00:29 +09:00
Jürg Lehni
75a10fb246 Boolean: Clear branch so we start with a new one on the next contour. 2016-08-04 12:21:58 +02:00
Jürg Lehni
79661c35e6 Some code cleanup in View#setViewSize() 2016-08-03 13:33:58 +02:00
Jürg Lehni
91371c1b47 Keep view.bounds in sync during 'resize' events.
Closes #1127
2016-08-03 13:08:08 +02:00
Jürg Lehni
fa3456341c Fix view flickering during window resizes.
Closes #1126
2016-08-01 17:10:00 +02:00
Jürg Lehni
78c5c27bb3 Boolean: More work on new branching code.
It now checks all intersections when there are multiple options first.
2016-07-28 12:14:02 +02:00
Jürg Lehni
f4f4b3472f Minor code optimization. 2016-07-27 22:58:57 +02:00
Jürg Lehni
17cca2984b Boolean: Make sure we're actually comparing multiple intersections. 2016-07-27 22:57:08 +02:00
Jürg Lehni
4c12f1505c Clean up previous commit. 2016-07-27 21:48:55 +02:00
Jürg Lehni
445d8ae22f Boolean: Implement branch structure to be able to go back on traces and try different crossings.
Relates to #1073
2016-07-27 21:40:53 +02:00
Jürg Lehni
c80c13eb9e Remove _closed parameter from PathItem#isClockwise() again. 2016-07-27 19:41:23 +02:00
Jürg Lehni
14b2d76450 Boolean: Improve handling of visited segments in intersect() operations.
Closes #1123
2016-07-27 19:35:19 +02:00
Jürg Lehni
aee9a3190d Improve handling of straight closing curves in open path checks. 2016-07-27 19:09:42 +02:00
Jürg Lehni
e643338422 Add options object to boolean operations and improve handling of open paths.
This closes #1036, closes #1072, closes #1089 and closes #1121
2016-07-27 17:09:52 +02:00
Jürg Lehni
a29ada8f23 Rename PathIterator back to PathFlattener. 2016-07-27 14:18:01 +02:00
Jürg Lehni
753b27afe0 Minor code and comments cleanup. 2016-07-27 14:11:58 +02:00
Jürg Lehni
9a49c2141c Two minor fixes in Base. 2016-07-26 10:25:32 +02:00
Jürg Lehni
34c57a47fa Use faster loop to handle prioritize in Base.filter() 2016-07-26 10:20:30 +02:00
Jürg Lehni
3f76bd99ef Implement an efficient mechanism to prioritize key in Item#set()
Closes #1096
2016-07-25 23:17:45 +02:00
Jürg Lehni
4954f5d6ab Improve Style#equals() to correctly handle default values.
Closes #1084
2016-07-25 21:42:06 +02:00
Jürg Lehni
29768c8228 Take Color#alpha default into account in Color#equals()
Relates to #1084
2016-07-25 21:09:53 +02:00
Jürg Lehni
e2e024f8a5 Winding: Don't mix up onPath and onCurve. 2016-07-23 18:50:58 +02:00
Jürg Lehni
31732917c0 Winding: Improve handling of on-curve tangent checks. 2016-07-23 13:30:40 +02:00
Jürg Lehni
27af304414 Improve new getWinding() direction flipping code. 2016-07-22 23:30:36 +02:00
Jürg Lehni
eab0b9db5e Correctly handle path.replaceWith(path) calls.
Closes #1118
2016-07-22 23:29:33 +02:00
Jürg Lehni
0b11f9e2dc Allow getWinding() to flip direction when on the path.
Flipping will only occur when the encountered tangent is parallel to the ray. Relates to #1116
2016-07-22 16:50:39 +02:00
Jürg Lehni
cbe41c536e Boolean: Return the full winding object from _getWinding() and use it to improve PathItem#contains() with even-odd full-rule.
Also store the full winding object on the processed segments, to have more information available in boolean operations.
2016-07-22 15:46:42 +02:00
Jürg Lehni
23f3097f84 Facilitate code minification in PathIterator. 2016-07-22 14:21:35 +02:00
Jürg Lehni
becac4c921 Use shorter zero checks for array indices and length.
Keeping === 0 for mathematical algorithms seems clearer.
2016-07-22 13:46:24 +02:00
Jürg Lehni
a5d04ef97c Address minor omission in previous commit. 2016-07-22 00:05:21 +02:00
Jürg Lehni
a5a0e90bee Implement PathItem#compare() to support compound-paths.
Still needs testing.
2016-07-21 23:07:01 +02:00
Jürg Lehni
ccac7ec7c5 Implement Path#compare() to compare for geometric equality of shapes.
Use it in boolean operations when handling fully overlapping paths.

Relates to #1109
2016-07-21 20:57:39 +02:00
Jürg Lehni
baf58fb021 Improve documentation of PathItem#getArea() and PathItem#isClockwise() 2016-07-21 15:30:31 +02:00
Jürg Lehni
a0417040f8 Improve handling of sub-path orientation in CompoundPath.
Remove automatic orientation on insertion, as it caused more troubles than solved problems, in favor of the new PathItem#reorient() method, or the even-odd fill-rule.

Closes #590, #1029
2016-07-21 15:21:45 +02:00
Jürg Lehni
fc72c05e69 Add sort parameter to PathItem#reorient()
And improve documentation. Relates to #590, WIP
2016-07-21 13:50:55 +02:00
Jürg Lehni
16e53cc1ad Minor reformatting and changes.
no need for paper namespace in unit test code
2016-07-20 17:58:47 +02:00
Jürg Lehni
58991a569e Merge pull request #1115 from iconexperience/addCurveIntersections-patch
Improve fat line clipping to fix #1088
2016-07-20 17:56:04 +02:00
Jürg Lehni
a683486ff5 Some code cleanup for previous commits, and shorten boolean tests a bit. 2016-07-20 16:32:21 +02:00
Jan
4c61153bd4 Improve fat line clipping to fix #1088
Only alternate curves in addCurveIntersections() if interval on other curve is not tight enough yet.
2016-07-20 16:32:20 +02:00
Jürg Lehni
f988445dad Boolean: Implement optimization for operands without crossings.
Closes #1113
2016-07-20 16:15:10 +02:00
Jan
3f893c9fb7 Change winding calculation for points on path
Add a winding if the point is on the path and windings canceled each other. See discussion at #1109
2016-07-20 10:47:01 +02:00
Jürg Lehni
1264c2764c Shorten code statement from #1111 2016-07-20 10:29:27 +02:00
Jan
08f633e7e6 Transfer handle when removing segment 2016-07-20 10:05:03 +02:00
Jürg Lehni
f874b927bf Reflect View#zoom through matrix decomposition, and implement additional decomposed properties.
Closes #1107
2016-07-20 00:04:24 +02:00
Jürg Lehni
4d9c0c9f05 Implement CompoundPath#getLength() 2016-07-19 19:09:23 +02:00
Jürg Lehni
08a23e3318 Boolean: Further improve segment sorting approach. 2016-07-19 16:14:46 +02:00
Jürg Lehni
2c8f4f9453 Boolean: Fix sort function to produce correct resutls on all browsers. 2016-07-19 14:55:57 +02:00
Jürg Lehni
0b672cfb62 Merge branch 'new-winding' into develop 2016-07-19 14:27:45 +02:00
Jürg Lehni
59d598f08e Some documentation improvements for previous commit. 2016-07-19 13:14:26 +02:00
Jürg Lehni
e539633852 Implement new and shorter segments array notation.
Supporting:

- Closing paths by including `true` as the last entry
- Nested segment arrays that can be passed to PathItem.create() and the CompoundPath constructor to create all sub-paths
2016-07-19 13:08:21 +02:00
Jürg Lehni
288c3d4012 Fix issue in setPathData(), horizontal or vertical lineto and relative moveto commands.
Relates to #1101
2016-07-19 10:09:55 +02:00
Jürg Lehni
ad48e93ee9 SVG: Output 'h' and 'v' commands in #getPathData() 2016-07-18 21:07:30 +02:00
Jürg Lehni
32d8c969fb Clean up handling of #_set(), #set() and #initialize()
Convention:

- #_set() is for actually setting properties, e.g. on Point, Size, so that derived classes can reuse other parts (e.g. SegmentPoint)
- #set() is a shortcut to #initialize() on all basic types, to offer the same amount of flexibility when setting values.
2016-07-18 20:11:01 +02:00
Jürg Lehni
3f058e6471 Split #resolveCrossings() into #resolveCrossings() and #reorient()
Closes #973
2016-07-18 14:04:51 +02:00
Jürg Lehni
7acb5bee45 Boolean: More refactoring and code simplifications. 2016-07-18 14:02:20 +02:00
Jürg Lehni
e94e872cda Move #getInteriorPoint() to PathItem, and refactor it a bit more. 2016-07-17 23:04:42 +02:00
Jürg Lehni
9b6fdb8952 Optimize #getInteriorPoint() further.
No need for two separate loops as it can all be done in one pass.
2016-07-17 21:08:22 +02:00
Jürg Lehni
fc18f821b1 Implement simplification of #getInteriorPoint()
As suggested by @iconexperience in https://github.com/paperjs/paper.js/issues/1075#issuecomment-233196940
2016-07-17 20:51:53 +02:00
Jürg Lehni
4bb2f7a8fc Revert a row of recent changes that break example in #1091 2016-07-17 20:35:36 +02:00
Jürg Lehni
c9100a2b61 Merge remote-tracking branch 'origin/develop' into new-winding
; Conflicts:
;	src/path/PathItem.Boolean.js
2016-07-17 19:52:20 +02:00
Jürg Lehni
09785a504b Boolean: Further tweak epsilons values.
Thanks to improved winding code, we can now reduce them to the point where the #_validOverlapsOnly hack can be removed altogether without introducing new issues.
2016-07-17 19:38:10 +02:00
Jürg Lehni
fe9acae985 Winding: More code refactoring and documentation. 2016-07-17 19:36:13 +02:00
Jürg Lehni
064cee1629 Boolean: Sort segments to give non-ambiguous segments preference when tracing.
Relates to #1075
2016-07-16 23:55:16 +02:00
Jürg Lehni
91e67887da Winding: Some improvements to comments and documentation. 2016-07-16 20:17:20 +02:00
Jürg Lehni
8513144ae1 Mono-curves: No need to filter out curves with no length any more. 2016-07-16 20:05:25 +02:00
Jürg Lehni
b1037f89f1 Winding: Add back support for open paths.
Includes refactoring of some related code.
2016-07-16 20:01:36 +02:00
Jürg Lehni
7d675dab13 Some minor cleanups. 2016-07-14 18:58:12 +02:00
Jürg Lehni
7da70181cc Move addWinding() into getWinding()
Allowing the reuse of a whole lot of shared variables and leading to some nice simplifications.
2016-07-14 18:53:23 +02:00
Jürg Lehni
cad2858070 Use same naming for prev* variables as elsewhere in boolean code. 2016-07-14 18:02:42 +02:00
Jürg Lehni
acfe6cddeb Boolean: Improve handling of open paths.
Relates to #1089
2016-07-14 10:49:12 +02:00
Jürg Lehni
c2df96c440 Implement CompoundPath#closed. 2016-07-14 10:24:04 +02:00
Jürg Lehni
41dce862d4 Fix CompoundPath#getLastCurve() and improve documentation. 2016-07-14 10:21:11 +02:00
Jürg Lehni
083a2c6e0d Boolean: Prevent rare exception where an encountered segment is not part of a valid path anymore.
Relates to #1091
2016-07-14 09:14:11 +02:00
Jürg Lehni
6ca3bb1c63 Prevent Path#getStrokeBounds() from accidentally modifying segments.
Closes #1102
2016-07-13 18:43:15 +02:00
iconexperience
46ea9da423 Small cleanup in getWinding() 2016-07-13 11:07:12 +02:00
Jürg Lehni
89c60b1a05 Loosely couple Node.js code to canvas module.
Treat absence of canvas module like a web worker context.
Relates to #1103
2016-07-12 19:11:09 +02:00
Jürg Lehni
73fc111b50 SVG: Correctly handle relative "moveto" commands.
Closes #1101
2016-07-11 19:48:17 +02:00
Jürg Lehni
a02f181c00 Release version 0.10.2 2016-07-09 21:04:37 +02:00
Jürg Lehni
9fefa7dbf0 Release version 0.10.1 2016-07-09 17:17:22 +02:00
Jürg Lehni
0b31b5fdc6 Release version 0.10.0 2016-07-09 16:37:39 +02:00
Jürg Lehni
e15de78347 Update JSHint and fix some some hinting errors. 2016-07-09 14:32:01 +02:00
Jürg Lehni
da78e837a1 Simplify Numerical.solveCubic() code by introducing evaluate() closure. 2016-07-09 13:54:02 +02:00
Jürg Lehni
9d6aab3802 Streamline handling of getNormalizationFactor() to share more code.
Based on comments by @hkrish in https://github.com/paperjs/paper.js/pull/1087#issuecomment-231529361
2016-07-09 13:28:50 +02:00
Jürg Lehni
2532f205a7 Prefer native Math.log2(), but support IE through internalized polyfill. 2016-07-09 12:54:17 +02:00
Jürg Lehni
7e3d18f5d4 Further cleanups in Numerical.solveQuadratic() 2016-07-09 01:10:55 +02:00
Jürg Lehni
02658c9e74 Clean-up code from PR #1087
Closes #1085
2016-07-09 01:01:19 +02:00
Jürg Lehni
90bc4ffecb Merge pull request #1087 from sapics/improve-poly-solve
Improvements to solve polynomials in Numerical.js
2016-07-07 06:39:28 +02:00
Jürg Lehni
866dcb50dd Some tweaks to potentially support strict mode. 2016-07-07 06:21:20 +02:00
Jürg Lehni
f04dd14309 Remove jsdom legacy code. 2016-07-03 14:16:17 +02:00
Jürg Lehni
df8969f1c4 Switch to jsdom v9.4.0 with native DOMParser support.
Closes #1093
2016-07-03 13:39:05 +02:00
Jürg Lehni
45ffc6fb88 Improve Segment constructor to correctly handle undefined values.
Closes #1095
2016-07-03 13:30:56 +02:00
iconexperience
916a712737 Improved and simplified addWinding and getWinding 2016-06-23 07:54:27 +02:00
Jan
f94b4f969b Accidential semicolon in var declaration
I think this is a mistake
2016-06-22 13:10:02 +02:00
sapics
4fd120fab8 Minor optimization in Numerical.js 2016-06-21 08:47:42 +09:00
sapics
645e2c2af3 Revert EPSILON error in solveCubic 2016-06-20 17:27:08 +09:00
sapics
78f65c9fab Improve solveQuadratic and solveCubic by hkrish c-code 2016-06-20 17:13:09 +09:00
sapics
a9cc938967 Fix normalization in solveQuadratic 2016-06-20 13:53:39 +09:00
sapics
bb683c9291 Remove same value solution in solveCubic 2016-06-20 13:52:54 +09:00
Jürg Lehni
ab24f92373 Bring back accidentally removed hit-test optimization in event handling.
See comment.
2016-06-19 11:02:54 +02:00
Jürg Lehni
739788b67e Clean up Event#currentTarget handlig. 2016-06-19 10:55:04 +02:00
Jürg Lehni
cc55991b66 Fix new issue with Emitter unit tests. 2016-06-18 23:14:48 +02:00
Jürg Lehni
f133475405 Implement MouseEvent#currentTarget and document MouseEvent#target.
Relates to #995
2016-06-18 23:06:17 +02:00
Jürg Lehni
f97143d37d Fix jshint issue introduced by a03631f620 2016-06-17 00:50:06 +02:00
Jürg Lehni
a03631f620 Remove MouseEvent#target hitTest() getter magic again.
Relates to #995
2016-06-17 00:42:40 +02:00
Jürg Lehni
74b22266f7 Clean up code from #1082 & #1083 2016-06-16 14:16:48 +02:00
Jürg Lehni
fa0a474ec7 Merge pull request #1083 from iconexperience/solve-cubic
Add check of value range in Curve.solveCubic to improve performance
2016-06-16 14:02:48 +02:00
Jan
7009fc3ea0 Add check of value range in solveCubic
Performance of `Curve.solveCubic()` can be improved by first checking if the specified value is within the curve's value range. If it is outside the range, the expensive call to `Numerical.solveCubic()` is not necessary.
2016-06-16 13:13:16 +02:00
Jan
c217e963b8 Rough bounds checking for _addBounds()
Performance of `_addBounds()` can be improved significantly by performing a rough bounds checking first. This is a cheap way to check if the curve can extend the current min or max values at all. Only if the check is passed, further Only if the current bounds can be extended by the curve's bounds, further calculation needs to be done.
Also, if the values of a curve are sorted, the extrema are simply the start and end point.
2016-06-16 12:46:12 +02:00
Jürg Lehni
827abd21b8 More refactoring for a328f5b04b 2016-06-16 12:07:38 +02:00
Jürg Lehni
e80b2ff043 Some code-cleanup for a328f5b04b 2016-06-16 11:48:29 +02:00
Jürg Lehni
85c680820e No more need for #_getCurves() since it now does the same as #getCurves()
#getCurves() works both on Path and CompoundPath. Relates to #1073, #1075
2016-06-16 11:16:56 +02:00
Jürg Lehni
1a392bb5db Rename monoCurves -> curves where full curves are dealt with now.
For better clarity. Relates to #1073, #1075
2016-06-16 11:15:27 +02:00
iconexperience
a328f5b04b Revamp winding calculation so it can determine the winding in horizontal and vertical direction. Monotonic curves are new only created on demand. 2016-06-16 10:13:10 +02:00
sapics
ff6484ba8c Fix to cover the case when Numerical.solveQuadratic return -1 in Numerical.solveCubic 2016-06-16 14:53:32 +09:00
sapics
c5b4828ace Fix to cover the case when Numerical.solveQuadratic return -1 in path._getMonoCurves culculation 2016-06-16 13:51:44 +09:00
Jan
262b9b388d Make Numerical.solveQuadratic() optimizable for Chrome V8
Little change to help Chrome's V( optimize `Numerical.solveQuadratic()`. In my use case this resulted in an overall performance improvement of about 1.5%. For details see #1078
2016-06-15 14:53:28 +02:00
Jürg Lehni
643df2d46d Add Raster#loaded to reflect the loading state of its image. 2016-06-14 17:08:32 +02:00
Jürg Lehni
c378050783 Fix linting error. 2016-06-14 17:02:05 +02:00
Jürg Lehni
2a3945c4a5 Add additional explanation to fix for #995 2016-06-14 16:54:16 +02:00
Jürg Lehni
724bcb2e35 Make sure mouse events propagate to the view while their targets remain consistent.
Closes #995
2016-06-14 16:52:31 +02:00
Jürg Lehni
93e4d81645 Clean up previous fix for #1069 by better handling mouseenter / leave events. 2016-06-14 16:15:50 +02:00
Jürg Lehni
6b3d8ecdfd Add missing semi-colon. 2016-06-14 15:26:08 +02:00
Jürg Lehni
f6b77b7442 Do not change cashed decomposed matrix data when transforming content.
Just clear the cache and force new decomposition on next use, to avoid issues with nested applied transforms.

Closes #1004
2016-06-14 15:16:45 +02:00
sapics
a0b868c1ba Fix indentations 2016-06-14 12:26:28 +09:00
sapics
7b91e41131 Fix variable leak 2016-06-14 12:20:58 +09:00
Jürg Lehni
28543deaf5 Boolean: Handle situations where seg.getNext() can be null.
Closes #1056
2016-06-13 14:17:47 +02:00
Jürg Lehni
742401a0e1 Fix Item#insertChildren() error when passing null for some children.
Relates to #1036
2016-06-13 14:16:25 +02:00
Jürg Lehni
693898a5b1 No more need for two passes of findBestIntersection()
Goodbye strict-mode :)
2016-06-13 12:49:57 +02:00
Jürg Lehni
fbe787dc4d Fix leaked global. 2016-06-13 12:13:42 +02:00
Jürg Lehni
8da82fed19 Mark all segments as visited when processing intersection and subtraction, not just overlaps. 2016-06-13 12:09:17 +02:00
Jürg Lehni
af5a5b5f2d Make findBestIntersection() more strict and improve comments. 2016-06-13 12:08:44 +02:00
Jürg Lehni
94853669f6 Do not complain about open paths if they would not contain an area when closed. 2016-06-13 12:08:04 +02:00
Jürg Lehni
7241edd98a Implement a more refined strategy to handle 'contour' segment in unite boolean operations.
Improvement for the fix in 648beb33e9 for #1054, solves the issues described in https://github.com/paperjs/paper.js/issues/1054#issuecomment-225356983
2016-06-13 11:58:18 +02:00
Jürg Lehni
34c35e26bd Switch to sampling only one location for winding contribution.
Closes #1073
2016-06-13 11:26:02 +02:00
Jürg Lehni
4c94553b81 Minor cleanup. 2016-06-13 09:00:29 +02:00
Jürg Lehni
fc600595a4 Implement improved strategy to handle tangents in CurveLocation#isCrossing()
Relates to #1074
2016-06-13 08:56:45 +02:00
Jürg Lehni
4966f6250f Implement better calculation of tangential angles in CurveLocation#isCrossing()
Relates to #1074
2016-06-12 18:53:14 +02:00
Jürg Lehni
5854c25dd5 Implement Curve#getOffsetAtTime() 2016-06-12 18:32:05 +02:00
Jürg Lehni
b0d0e41ddc Allow negative offsets in all Curve#get*At() methods.
To search from the end of the curve instead of the beginning.
2016-06-12 18:21:37 +02:00
Jürg Lehni
7404485f96 Simplify isInRange() check a bit.
No need to check against ±180 as that condition will always be met.
2016-06-12 17:43:10 +02:00
Jürg Lehni
614c781f29 Put the recursion cap back into fat-line clipping code.
But use a higher value, and have it work in conjunction with call-count cap.
Relates to #1074
2016-06-12 17:07:43 +02:00
Jürg Lehni
452bbfdaa4 Add unit tests and change-log entry for #904
Closes #904
2016-06-11 13:13:08 +02:00
Jürg Lehni
d1f1d7a5f6 Change behavior of PathItem#closePath() to always attempt joining segments.
Add optional tolerance argument, and use it to handle SVG imprecisions.
Closes #1045
2016-06-11 12:43:37 +02:00
Jürg Lehni
de8b626033 Add tolerance argument to Path#join(path, tolerance) 2016-06-11 12:41:23 +02:00
Jürg Lehni
68be3f102e Prevent mousedown events from disturbing mousenter / mouseleave.
Closes #1069
2016-06-11 11:14:19 +02:00
Jürg Lehni
41e4c622a3 Improve fat-line clipping for rare edge cases.
Instead of limiting recursion levels, limit actual call count. Relates to #904
2016-06-10 23:51:56 +02:00
Jürg Lehni
715025725d Improve handling of SymbolItem bounds with #applyMatrix = false.
Closes #1070
2016-06-10 21:32:22 +02:00
Jürg Lehni
ed3e283802 Fix Item#importJSON() to preserve #parent on existing, already inserted items.
Closes #1041
2016-06-10 17:45:02 +02:00
Jürg Lehni
e7f7d7c5d1 Fix jshint error caused by #1065 2016-06-10 17:28:46 +02:00
Jürg Lehni
2c2542fb2f Remove unique IDs from Color objects. 2016-06-10 16:19:59 +02:00
Jürg Lehni
0d2779dfc5 Docs: Define default value for PathItem#flatten()
And some other minor cleanups.
2016-06-10 14:53:52 +02:00
Jürg Lehni
964d8cf7d6 PaperScript: Only translate == to equals() calls for Point, Size and Color.
Closes #1043
2016-06-10 13:41:36 +02:00
Jürg Lehni
648beb33e9 Take type of boolean operation into account in getWinding()
Relates to #1054
2016-06-10 13:04:57 +02:00
Jürg Lehni
803dfb6bb1 Improve reliability of Curve#isStraight()
Closes #1066
2016-06-10 12:33:44 +02:00
Jürg Lehni
1f4e4f2f60 Implement boolean simplification suggested by @iconexperiene
See https://github.com/paperjs/paper.js/issues/1054#issuecomment-222517963
2016-06-10 12:06:08 +02:00
Jürg Lehni
719392dd2c Merge pull request #1060 from iconexperience/patch-3
Check for prevTime >= tMin and prevTime <= tMax
2016-06-10 12:00:23 +02:00
Jan
e564955501 Correclty implement sorting of intercepts
`Array.sort()` without comparison function does not sort by numeric value, but by unicode characters (103 comes before 93 by this sorting), therefore a simple comparison function is required.
2016-06-07 16:44:42 +02:00
Jan
b735a3ec95 Fix getInteriorPoint()
getInteriorPoint() could return a point outside the path as explained in #1064
This fix excludes curve's start points from intercept detection to prevent double counting, it ensures that all intercepts are collected and the intercepts are sorted by x-value.
2016-06-07 16:11:37 +02:00
Jan
9f93f6ee78 Check for prevTime >= tMin and prevTime <= tMax
Parameter scaling should only be done if the curve was actually split previously. This only happened if prevTime greater tMin and less tMax.
2016-06-01 14:38:44 +02:00
Jürg Lehni
f19d0c8134 Rename GradientStop#rampPoint to #offset 2016-05-31 12:35:44 +02:00
Jürg Lehni
f07927a95e Correctly handle { x: 0, y: 0 } in Raster#getAverageColor()
Closes #1053
2016-05-27 11:42:08 +02:00
Jürg Lehni
9aa29e0afc Add support for construction from strings to Point and Size. 2016-05-27 11:37:19 +02:00
Jürg Lehni
fefb4302e8 Improve Item#_getStrokeMatrix() 2016-05-22 21:23:46 +02:00
Jürg Lehni
948a8af9a8 Fix Item#strokeBounds with #strokeScaling and #applyMatrix
Closes #1014
2016-05-22 21:17:24 +02:00
Jürg Lehni
be79a0e504 Cleanup Path#flatten() code. 2016-05-22 17:24:12 +02:00
sapics
78498f4fd5 Add last curve segment point in path.flatten 2016-05-06 13:28:27 +09:00
Jürg Lehni
681d5537b3 Always pass on dictionary object in _serialize()
It is used to determine if ojects can be serialized in compact form.
2016-05-04 18:06:18 -07:00
Jürg Lehni
4f65996d34 Fix #1032: Correctly handle lastPoint in first mousemove.
Improve first attempt of a fix in e054b760ed
2016-04-13 15:52:59 -07:00
Jürg Lehni
e0a0cd58d5 PaperScript: Improve tool detection code.
And implement Multiple Tools example.
2016-04-13 15:21:35 -07:00
Jürg Lehni
d8d61ff160 Fix #1015: Improve handling of already inserted children in#insertChildren() 2016-04-13 13:36:26 -07:00
Jürg Lehni
345730f634 Merge pull request #1002 from sapics/curve-divide
Call curve._changed at curve.divideAtTime
2016-04-06 20:24:55 -07:00
Jürg Lehni
ff82e43d2f Fix GradientStop support in SVG export.
Closes #1027
2016-04-06 20:17:13 -07:00
Jürg Lehni
84421abbce Set crossOrigin before src on image objects.
Reason: https://bugs.chromium.org/p/chromium/issues/detail?id=341047
2016-04-05 12:25:24 -07:00
Jürg Lehni
5a9f3dfb27 Improve handling of local paths and CORS on Node.js 2016-04-05 12:11:54 -07:00
Jürg Lehni
093227be7e Fix leaked global variable. 2016-04-04 23:38:37 -07:00
Jürg Lehni
ae9ff56260 Improve check for local URLs in paper.resolvePath() 2016-04-04 23:30:53 -07:00
Jürg Lehni
7cf844886f Add support for relative (local) URLs on Node.js 2016-04-04 23:26:43 -07:00
Jürg Lehni
f4e4e7ab9c Switch to jsdom v8.3.0, now that it includes our node-canvas PR.
See https://github.com/tmpvar/jsdom/pull/1366
2016-04-04 17:55:43 -07:00
Jürg Lehni
20fc3b9f0f Optimize Curve.getArea() to use less operators.
As proposed by @iconexperience in https://github.com/paperjs/paper.js/issues/994#issuecomment-189946135, rearranged for mathematical symmetry.
Closes #994
2016-03-28 08:17:27 -07:00
Jürg Lehni
fc03e042f9 Some minor code and comment cleanup. 2016-03-28 07:59:55 -07:00
Jürg Lehni
e054b760ed Fix cases where toolPoint was null. 2016-03-27 21:41:22 -07:00
Jürg Lehni
1a0c15f177 Fix #1021: use Item#getStyle() to use correct parent style in CompoundPath bounds calculations. 2016-03-27 13:39:30 -07:00
Jürg Lehni
3b71de9544 Fix #980: Implement visual selection of item.position 2016-03-17 14:15:28 +01:00
Jürg Lehni
00b2102b6d More clean-up of selection handling refactoring. 2016-03-17 13:36:02 +01:00
Jürg Lehni
336bc1092e Replace Item#_boundsSelected with #_selectBounds
Plus some refactoring.
2016-03-17 13:09:02 +01:00
Jürg Lehni
f0edcd31b0 Fix #769: Implement Item#selection flags to separate selection from item and bounds. 2016-03-17 13:02:26 +01:00
Jürg Lehni
f7bb96e8b9 Fix #1000: Improve calculation of length of straight curves.
Support sub-ranges now too, through Curve.subdivide()
2016-03-17 11:24:20 +01:00
Jürg Lehni
6cd36f5460 Fix #1001: Convert absolute local gradient URLs back to relative ones. 2016-03-17 09:48:43 +01:00
Jürg Lehni
d93aca6b5c Refactor GradientStop: Improve handling of optionally defined color and rampPoint.
Relates to https://github.com/paperjs/paper.js/issues/1001#issuecomment-197557990
2016-03-17 09:38:42 +01:00
Jürg Lehni
0e658da104 SVG Import: Improve style inheritance in nested <defs> 2016-03-16 20:47:57 +01:00
Jürg Lehni
ca76c1d24f Fix #1009: Make sure all name lookup structures are kept in sync for layers too. 2016-03-16 09:56:10 +01:00
Jürg Lehni
84d2a2f908 SVG Import: Fix issues with viewBox. 2016-03-15 19:00:35 +01:00
Jürg Lehni
484d696df3 Fix #1008: Remove use of ActiveXObject in Http.request() 2016-03-14 19:40:46 +01:00
Jürg Lehni
da7d0d8f75 Implement Path#splitAt(offset)
Also make sure the deprecated Path#split(offset) works as it used to. Relates to #563
2016-03-14 18:59:09 +01:00
Jürg Lehni
af1c481523 Correctly handle trailing slashes in XML attribute namespaces.
See #984
2016-03-14 18:31:45 +01:00
sapics
60f1e78889 Call curve._changed at curve.divideAtTime 2016-03-05 12:23:02 +09:00
Jürg Lehni
7dd110f5b2 Simplify Path#getArea()
Relates to #994
2016-02-26 17:49:44 +01:00
Jürg Lehni
1db419a87b Rename SegmentSelection related internal objects and properties.
Relates to #769, #980
2016-02-26 16:31:50 +01:00
Jürg Lehni
08bf7bfe60 Fix #995: Improve handling of event propagation on View and Item. 2016-02-26 15:13:49 +01:00
Jürg Lehni
69c34707e7 fix #994: Revert commit b5af47a7b1
Revert back to correct implementation of Path#getArea() and implement unit tests for it.
2016-02-26 12:58:50 +01:00
Jürg Lehni
9f90659fdb Fix #991: Make sure items get fully removed in removeChildren() 2016-02-23 11:59:59 +01:00
Jürg Lehni
50bd5bee6f SVG: Add comments explaining IE related changes in #984 2016-02-20 00:19:36 +01:00
Jürg Lehni
acb1e408d0 SVG Import: Fix namespacing issues introduced by #984 2016-02-19 23:30:54 +01:00
Jürg Lehni
b71e3a44d9 Fix #981: Make sure event.delta is always calculated correctly.
The first mousemove / mousedrag events wrongly received the delta from the last mouseup event.
2016-02-19 13:49:06 +01:00
aschmi
49104c5cf0 Add trailing slashes to svg related namespaces (xmlns, xlink) 2016-02-18 16:08:12 +01:00
aschmi
a4757b37de Extend mapping of attribute names to required namespaces 2016-02-18 16:07:56 +01:00
Jürg Lehni
b5c837bb87 Fix #982: Make sure self points to the global scope on Webpack. 2016-02-17 19:06:29 +01:00
Jürg Lehni
6df4602b2b Fix #977: Implement unit-tests. 2016-02-16 20:52:07 +01:00
Jürg Lehni
4081afb635 Fix #977: Apply hit-testing tolerance to fills in Shape. 2016-02-16 00:28:04 +01:00
Jürg Lehni
6975690824 SVG Export: Do not filter out empty paths. 2016-02-16 00:06:26 +01:00
Jürg Lehni
7f48486163 Merge pull request #976 from iconexperience/patch-2
Fix #974 - Keep empty clip mask in SVG export
2016-02-16 00:01:36 +01:00
Jürg Lehni
c35814f94f Node.js: Fix bug when using paper-core.js
And improve Node.js examples. Closes #975
2016-02-15 23:59:31 +01:00
Jürg Lehni
16a7baa967 SvgImport: Fix issues introduced in 6f4890c63c 2016-02-15 23:58:40 +01:00
Jan
b5b1aa57d7 Keep empty clip mask in SVG export
A path should be exported in SVG if it serves as a clip mask, otherwise all items in the clip group that were hidden by clipping in paper.js become visible in the SVG.
2016-02-15 15:29:19 +01:00
Jürg Lehni
3d330da4fc Fix failing unit tests. 2016-02-15 09:21:11 +01:00
Jürg Lehni
08e51b5ca4 Fix failing SVG unit test. 2016-02-15 08:42:59 +01:00
Jürg Lehni
6f4890c63c Implement new options to control bounding box in SVG Export
And use it to support SvgExport unit tests. Relates to #972
2016-02-15 00:13:38 +01:00
Jürg Lehni
21033f7850 Implement PathItem.create(pathData)
determining if the data describes a plain path or a compound-path with multiple sub-paths.
2016-02-14 23:16:22 +01:00
Jürg Lehni
9f9222f416 List all supported events in event methods on View. 2016-02-14 23:04:48 +01:00
Jürg Lehni
3c3c8d98b0 Document options.insert in #importSVG() 2016-02-14 22:54:33 +01:00
Jürg Lehni
dba4eb371d SvgImport: Implement options.insert to control insertion.
Also use settings.insertItems for faster import. Closes #763
2016-02-14 22:51:50 +01:00
Jürg Lehni
8d5c922c50 Simplify code from #971 and activate unit test for it again. 2016-02-14 22:15:55 +01:00
Jürg Lehni
4c72d9866f Merge pull request #971 from iconexperience/fix-issue-968
Fix for #968 - Improve handling of points on paths in getWinding()
2016-02-14 22:06:55 +01:00
Jürg Lehni
55e7689186 Fix regression introduced in 4e7fa2f04e 2016-02-14 21:55:26 +01:00
Jan
406e6c95b9 Adjust comments to match new implementation 2016-02-14 21:44:34 +01:00
Jürg Lehni
4e7fa2f04e Implement PaperScope#settings.insertItems
Controlling whether newly created items are automatically inserted into the scene graph.
2016-02-14 21:34:35 +01:00
iconexperience
e2eaf87fcb Improve handling of points on paths in getWinding() 2016-02-14 20:57:24 +01:00
Jürg Lehni
56dd636f22 JSON: Improve serialization and deserialization on objects other than Item.
Closes #392
2016-02-14 17:16:40 +01:00
Jürg Lehni
75c40babc9 SvgImport: Implement support for onLoad and onError callbacks on string input.
Closes #827
2016-02-14 15:12:52 +01:00
Jürg Lehni
2025bd1a77 SvgImport: Implement onError() callback
Closes #969
2016-02-14 14:52:37 +01:00
Jürg Lehni
79d446136a Clean up PR #931
Closes #930
2016-02-14 14:15:17 +01:00
Jürg Lehni
9c9f40d05a Merge pull request #931 from sapics/path-arc
Fix path.arcTo error
2016-02-14 14:11:52 +01:00
Evgeniy Malyarov
add28666cf Update Path.js
fix getNearestPoint error on uninserted curves
; Conflicts:
;	src/path/Path.js
2016-02-14 14:03:54 +01:00
Evgeniy Malyarov
fb76065242 Update Curve.js
fix getNearestPoint error on uninserted curves
2016-02-14 14:03:00 +01:00
Jürg Lehni
e6f43da22b Fix various issues with scaling of shadows.
Supports browser-zoom, HiDPI canvas and view zoom.
Closes #831
2016-02-14 13:49:40 +01:00
Jürg Lehni
fa6c1f47b4 Hit-Test: Pass viewMatrix as argument instead of in options object. 2016-02-14 13:34:35 +01:00
Jürg Lehni
4a947317fb Implement #hitTestAll() on Item and Project
Along with unit tests and documentation.
Closes #536
2016-02-14 12:39:35 +01:00
Jürg Lehni
3ee46ffc5c Matrix: Switch to a better implementation of #decompose()
This now also correctly handles skewing in SVG export.
2016-02-14 10:59:57 +01:00
Jürg Lehni
e35a55fe66 Flip Matrix properties #b and#c
Their definition was reversed from almost all other Matrix implementations I've encountered.
2016-02-14 10:53:10 +01:00
Jürg Lehni
40d0fca9d0 Fix issue with item bounds permanently collapsing to 0 when applying non-invertible transformations.
We have to keep a backup of the last invertible state around.
Fixes #558 rather elegantly.
2016-02-14 10:44:41 +01:00
Jürg Lehni
dbd7a90e23 Better detect code that requires a tool object.
Closes #967
2016-02-14 01:45:16 +01:00
Jürg Lehni
27197bd156 Docs: Fix warning about isFlatEnough() 2016-02-13 23:32:29 +01:00
Jürg Lehni
0a6efe10f5 Give Tool a paperscript example.
Closes #967
2016-02-13 23:31:54 +01:00
Jürg Lehni
c3fff9fa83 Switch from new Base() to Base.set({}) where possible. 2016-02-13 23:10:09 +01:00
Jürg Lehni
009761d13c Boolean: Only compare segments when determining if paths are identitcal. 2016-02-13 22:58:42 +01:00
Jürg Lehni
3348fb736f Boolean: Implement proper handling of fully overlapping (identical) paths and sub-paths.
Closes #923, closes #958
2016-02-13 22:41:09 +01:00
Jürg Lehni
0a196daa21 Clean-up previous commit. 2016-02-12 21:23:47 +01:00
Jürg Lehni
c6bcf4351a Implement consistent checks for fill / stroke / shadow styles in test functions on Style class.
And use them in Item#_setStyles()
2016-02-12 21:22:30 +01:00
Jürg Lehni
e38829eb96 Support drawing shadows with no shadowBlur.
Closes #955
2016-02-12 21:05:05 +01:00
Jürg Lehni
84a75e375a Remove unnecessary edge-case handling in CurveLocation#isCrossing()
Closes #951, closes #959
2016-02-12 20:52:19 +01:00
Jürg Lehni
e2bc83af5d Add test for #960 and improve fix a bit.
Closes #960
2016-02-12 20:19:40 +01:00
Jürg Lehni
7c24fc916f Merge pull request #962 from iconexperience/fix-issue-960
Fix for #960 - Shortcut Curve.evaluate() for t === 1
2016-02-12 20:10:21 +01:00
Jürg Lehni
6d5d1ce077 Introduce Base.filter(), to copy and filter object properties. 2016-02-12 19:58:32 +01:00
Jürg Lehni
06d6b5195b Do not cancel mousedrag events on stopPropagation()
Use preventDefault() instead.
Closes #952
2016-02-12 19:01:34 +01:00
Jürg Lehni
12f829c107 Part 2 of large refactoring of bounds handling. 2016-02-12 18:54:06 +01:00
Jürg Lehni
55c5f42716 Part 1 of large refactoring of bounds handling. 2016-02-12 17:59:37 +01:00
iconexperience
aa1f2196c9 Shortcut Curve.evaluate() for t === 1 to avoid imprecision. 2016-02-12 14:41:21 +01:00
Jürg Lehni
6797d2eb11 Respect clip-items in Group#_getBounds()
Closes #956
2016-02-11 12:51:04 +01:00
Jürg Lehni
68c4541844 SvgImport: Always create a clip-item when viewBox is specified. 2016-02-11 12:50:08 +01:00
Jürg Lehni
e38a33fd64 SVGImport: Inherit default styles on Node.js too. 2016-02-11 11:20:32 +01:00
Jürg Lehni
df57c4adb9 SVGImport: Improve consistency of style handling. 2016-02-11 11:06:09 +01:00
Jürg Lehni
d9e09b9d20 SVGImport: Further improve handling of gradients
- Respect radial setting when reusing graident definition
- Clean-up percentage handling
2016-02-10 18:23:56 +01:00
Jürg Lehni
c1b7366249 Improve fix for #650
Add support for multiple use of same gradient.
2016-02-10 18:13:13 +01:00
Jürg Lehni
fce126959d SVGImport: Implement support for gradientUnits="objectBoundingBox"
Relates to #650, but still needs unit tests.
2016-02-10 17:46:39 +01:00
Jürg Lehni
98fc51319f Remove unnecessary double-spaces. 2016-02-10 16:15:35 +01:00
Jürg Lehni
56d5b3b323 SVGImport: Implement support for dimensions in percentage.
Closes #954
2016-02-10 16:14:51 +01:00
Jürg Lehni
adc5b86d2e SVGExport: Remove unnecessary calls to Point#transform() in exportGradient() 2016-02-10 15:34:22 +01:00
Jürg Lehni
9e8fcee8cd Change implementation of PathItem#flatten(flatness)
- flatness parameter specifies maximum allowed error instead of maximum allowed distance between point
- Parts that are already flat are not further flattened
- Corners are preserved

Closes #618
2016-02-10 14:58:40 +01:00
Jürg Lehni
00d2e2a5bb Some CurveLocation cleanup.
- Remove UID as there is no need anymore
- Rename some private properties
2016-02-10 12:36:39 +01:00
Jürg Lehni
0ae232e4ab Implement support for clip-masks in hit-testing.
Closes #671
2016-02-09 17:02:03 +01:00
Jürg Lehni
740c94e367 Implement Item#_hitTestChildren()
As suggested by @iconexperience in #671
2016-02-09 16:52:55 +01:00
Jürg Lehni
bd7f3554d8 Fix options handling in Item#clone() to keep backward compatibility. 2016-02-09 16:11:38 +01:00
Jürg Lehni
e179b08156 Implement Item#clone(options) with support for options.deep
Closes #941
2016-02-09 16:01:06 +01:00
Jürg Lehni
21723ca6ca Improve documentation of PostScript-style drawing commands. 2016-02-09 15:09:39 +01:00
Jürg Lehni
717bc4bc79 Implement PathItem#getNearestLocation() / #getNearestPoint()
Closes #727
2016-02-09 14:34:21 +01:00
Jürg Lehni
a48d13878a Fix JSDoc warning on Style class. 2016-02-09 14:15:55 +01:00
Jürg Lehni
3965dd9b77 Implement CompoundPath#flatten(), #simplify(), #smooth()
And improve documentation for PathItem#simplify().

Closes #920
Relates to #727
2016-02-09 14:13:30 +01:00
Jürg Lehni
c793538841 No need to pass normalized tangents to PathFitter#fitCubic()
The get normalized and scaled anyway.
2016-02-09 14:11:23 +01:00
Jürg Lehni
e5d139ca11 Clean-up PathFitter code. 2016-02-09 14:09:53 +01:00
Jürg Lehni
d1b11c6ea9 Rearrange method sequence in Path. 2016-02-09 12:47:37 +01:00
Jürg Lehni
de9653ab45 Fix new exception in unit tests. 2016-02-09 10:07:28 +01:00
Jürg Lehni
da216aa581 Improve handling of view updates and detection of invisible documents.
Switch to the new HTML5 Page Visibility API.
2016-02-09 09:59:19 +01:00
Jürg Lehni
0371f66bda Do not snap curve points to t = 0 / 1 with epsilon
Closes #936. Also:
- Reduce CLIPPING_EPSILON to 1e-9 to fix errors that were masked by the snapping
- Implement unit tests for edge cases in #936
2016-02-06 15:12:35 +01:00
Jürg Lehni
ffe42a0220 Some comment cleanup. 2016-02-05 20:31:58 +01:00
Jürg Lehni
5a46620768 Merge branch 'winding-fix' into develop
; Conflicts:
;	src/path/PathItem.Boolean.js
2016-02-05 20:25:25 +01:00
Jürg Lehni
55909b8bd5 Some code cleanup for winding-fix. 2016-02-05 19:43:48 +01:00
iconexperience
5b31aee8bb Change the implementation of getWinding() again, so we pass all tests. This new version does not count any intersections if the point is on a y-monotonic curve, but at the final calculation it sets the winding to at least 1 if the point is on a curve. 2016-02-05 14:48:27 +01:00
Jürg Lehni
fc4bdf4bd0 Use correct SVG namespace again.
It got mixed up in recent refactoring (d68239a541).
2016-02-03 18:39:00 +01:00
Jürg Lehni
f7b1aca3e4 Revert "Change the way we determine the winding in getWinding()." 2016-02-03 17:46:27 +01:00
Jürg Lehni
0152439627 Fix internalBounds regression caused by 1ac8e46d55 2016-02-03 17:39:03 +01:00
Jürg Lehni
41aca10112 Clean-up changes from #939 2016-02-03 12:54:54 +01:00
iconexperience
aed9d05bfc Change the way we determine the winding in getWinding(). Now the windings only get counted if the point is not on any of the y-monotonic curves. If the point is on a curve, the winding will be made odd at the very end. 2016-02-03 11:29:43 +01:00
Jürg Lehni
96d617a5ff Only attempt to reuse object that importJSON() is called on, when its type matches the root of the imported data.
Closes #764
2016-02-03 09:47:49 +01:00
Jürg Lehni
7888d1d107 JSON: Prevent name: undefined exports. 2016-02-03 09:46:40 +01:00
Jürg Lehni
0f084eaf02 Optimize Emitter._installEvents()
Check for #_eventTypes first, no need to do anything if they don't exist.
2016-02-03 09:46:25 +01:00
Jürg Lehni
922a502ee2 Add #interpolate() method to Segment, Path and CompoundPath
Closes #624
2016-02-02 22:11:06 +01:00
Jürg Lehni
53269ab169 Merge pull request #938 from iconexperience/getWinding-simplification
Simplify getWindings() by using only the 'last' property to understand when a new loop starts.
2016-02-02 21:45:04 +01:00
Jürg Lehni
5e53939006 Do not include text-styles in items that don't relate to text.
Closes #934
2016-02-02 21:43:44 +01:00
iconexperience
0716ebb994 Simplify getWindings(), The first curve of a loop always has the 'last' property set. We use this to know when a loop starts. The very rare cases when a loop only consists of horizontal curves are not a problem, because these curves are ignored. Using this simplification also get's rid of the 'length' property, which was set in _getMonoCurves(). 2016-02-02 21:23:46 +01:00
Jürg Lehni
8fb7c41537 Implement support for web-workers.
Relates to #634, closes #582
2016-02-02 17:30:38 +01:00
Jürg Lehni
74d188967c Fix accidentally leaked global variable. 2016-02-02 14:03:25 +01:00
Jürg Lehni
a71c364594 We cannot cache #strokeBounds when #strokeScaling is false.
Closes #697
2016-02-02 13:56:08 +01:00
Jürg Lehni
340a1e2a5f Rename curve-time in API from 'parameter' to 'time'
And create separate versions of methods that receive curve-time arguments instead of offsets.

Curve#getNormalAt(time, true) -> #getNormalAtTime(true)
Curve#divide() -> #divideAt(offset) / #divideAtTime(time)
Curve#split() -> #splitAt(offset) / #splitAtTime(time)
Curve#getParameterAt(offset) -> #getTimeAt(offset)
Curve#getParameterOf(point) -> getTimeOf(point)
Curve#getPointAt(time, true) -> #getPointAtTime(time)
Curve#getTangentAt(time, true) -> #getTangenttTime(time)
Curve#getNormalAt(time, true) -> #getNormalAtTime(time)
Curve#getCurvatureAt(time, true) -> #getCurvatureAtTime(time)
CurveLocation#parameter -> #time
Path#split(offset/location) -> #splitAt(offset/location)

Closes #563
2016-02-02 11:59:53 +01:00
Jürg Lehni
a12e99e387 Implement unit tests for SVG Importing, based on visual comparison.
For now, one test for #932
2016-02-01 20:15:37 +01:00
Jürg Lehni
8e25327b09 Fix wrongly copied attributes in Item#reduce()
Closes #932
2016-02-01 20:12:54 +01:00
Jürg Lehni
ad21b2b07a SVG: Pass the imported SVG date as the 2nd parameter to onLoad() 2016-02-01 20:09:43 +01:00
Jürg Lehni
b2f3b587ec Events: paper namespace may not be initialized when key evens are emitted. 2016-02-01 12:58:52 +01:00
Jürg Lehni
1c4ff31e6c SVG: Some renaming omitted in previous commit. 2016-02-01 12:52:50 +01:00
Jürg Lehni
af5984747f SVG: Rename 'SVG' prefix to 'Svg'
- To make it clear it's not browser-provided functionality
- To reflect how DomElement / DomEvent are already named, for the same reason
2016-02-01 12:50:22 +01:00
Jürg Lehni
519898357f SVG: Fix issue with invalid default stroke-width on IE.
Closes #467
2016-02-01 12:36:42 +01:00
Jürg Lehni
d68239a541 SVG: Introduce SVGNode object to handle SVG Elements. 2016-02-01 12:31:18 +01:00
Jürg Lehni
3d346d8045 Core: Do not serialize deprecated Style#font property.
Relates to #934
2016-02-01 12:19:12 +01:00
Jürg Lehni
50843d8f87 Node: Switch to jsdom v8.0.1 with patched-in image support.
And fix XMLSerializer#serializeToString() to work with it.
2016-01-31 22:47:57 +01:00
Jürg Lehni
bc2729683c Core: Renamed Symbol and PlacedSymbol classes and properties.
- Symbol -> SymbolDefinition
- PlacedSymbol -> SymbolItem
- Symbol#definition -> SymbolDefinition#item
- PlacedSymbol#symbol -> SymbolItem#definition
- Deprecate Project#symbols

Closes #770
2016-01-31 16:52:51 +01:00
Jürg Lehni
1a3a4be0b6 Gulp: Implement publish task. 2016-01-31 14:30:14 +01:00
Jürg Lehni
90e1cf8f5e Canvas: Throw an error if a canvas cannot provide a 2D context. 2016-01-31 12:43:38 +01:00
Jürg Lehni
e02e9f4643 Node: Improve DOMParser#parseFromString() polyfill for Node.js
And no need to move imported SVG nodes into document, since we don't have styling in Node.js
2016-01-31 12:43:38 +01:00
Jürg Lehni
4c84c3dad5 Tests: Start getting QUnit tests to work on Node.js
Work in progress…
2016-01-31 12:43:20 +01:00
Jürg Lehni
0c1b4376d3 Core: Fix issue with RegExp detection if object is from another context. 2016-01-31 12:43:03 +01:00
Jürg Lehni
fadef949ff Node: Fix display of percentage in Node.js frames export. 2016-01-31 12:42:53 +01:00
sapics
923caaaaab Fix path.arcTo error 2016-01-29 18:41:17 +09:00
Jürg Lehni
0455d39e33 Automatically determine correct padding for numbers in View#exportFrames() 2016-01-27 13:38:04 +01:00
Jürg Lehni
85d60e199e Get View#exportFrames() to work again on Node.js 2016-01-27 13:27:11 +01:00
Jürg Lehni
e7c4e3c990 Implement View#autoUpdate to control automatic updates.
Closes #921
2016-01-27 13:10:04 +01:00
Jürg Lehni
b56d18d6a4 Override DomEvent.requestAnimationFrame() in Node.js to avoid setInterval() timers 2016-01-27 13:02:50 +01:00
Jürg Lehni
414742459d Make sure PDF support actually works. 2016-01-27 12:51:26 +01:00
Jürg Lehni
1e649362bd Fix issue in View#exportImage() 2016-01-27 12:51:02 +01:00
Jürg Lehni
b40ff49523 Add explanation about View#_itemEvents.native. 2016-01-27 12:17:38 +01:00
Jürg Lehni
5fa0810ca3 Streamline View#_countItemEvent() code a bit. 2016-01-27 12:15:00 +01:00
Jürg Lehni
0cfa83fc32 Make item-level mousedrag events work again. 2016-01-27 12:11:59 +01:00
Jürg Lehni
d22104985d Fix spelling mistake. 2016-01-27 11:51:54 +01:00
Jürg Lehni
810428569a Some jshint related fixes. 2016-01-27 11:45:20 +01:00
Jürg Lehni
d92628a432 Make click and doubleclick events work on View. 2016-01-27 11:38:45 +01:00
Jürg Lehni
3276616f53 Introduce Item._itemHandlers to remove code redundancy. 2016-01-27 11:38:14 +01:00
Jürg Lehni
ed8a904b74 Some Curve._evaluateMethods related cleanup. 2016-01-27 11:37:12 +01:00
Jürg Lehni
849688833e Implement key events on View.
Closes #896
2016-01-27 11:36:39 +01:00
Jürg Lehni
0b991cefdd Only mark an image as loaded if it actually has src set and is complete. 2016-01-27 10:45:39 +01:00
Jürg Lehni
8391543115 Further improve Raster documentation. 2016-01-27 10:39:03 +01:00
Jürg Lehni
9cf912090c Implement Raster#_setImage() that doesn't trigger events.
For internal use / updates.
2016-01-27 10:33:01 +01:00
Jürg Lehni
26a64415a5 Document Raster#onLoad() and #onError() 2016-01-27 10:32:28 +01:00
Jürg Lehni
c5632d8a6a Improve documentation for event handlers on View and Item. 2016-01-27 10:27:14 +01:00
Jürg Lehni
52017340d2 Do not fire two subsequent mousedown events.
This should fix #922, but needs testing.
2016-01-27 09:53:09 +01:00
Jürg Lehni
caa93a51ca Improve handling of removeOn*() and filter out duplicate move events.
Closes #913
2016-01-27 09:48:20 +01:00
Jürg Lehni
ee4760afc4 Fix issue with zoomed retina canvases when repeatetly initializing same view canvas. 2016-01-27 09:38:57 +01:00
Jürg Lehni
e722be5b62 Add support for PDF canvas on Node.js again. 2016-01-27 09:34:37 +01:00