Jürg Lehni
1e768e6c83
Fix #strokeBounds for strokes scaled using #matrix.
...
Gotta do the right thing, not the same buggy thing as Illustrator.
2011-12-19 23:21:13 +01:00
Jürg Lehni
4a46c8ac98
Fix recently introduced error with stroke/fillColor handling
...
Since CanvasContext#stroke/fillStyle cannot be set to null, we have to keep checking Style#fill/strokeColor even after calling #_setStyles().
2011-12-19 23:07:14 +01:00
Jürg Lehni
cc26fdc5d1
Optimise handling and setting of fill and stroke styles.
...
Handle setting of fillColor and strokeColor in Item#_setStyles() instead of the various #draw() methods, directly access internal styles instead of using accessor calls and fix PointText#draw().
2011-12-19 22:40:14 +01:00
Jürg Lehni
f5c1125709
Move Path#_setStyles() to Item, so it can be used in PointText too.
2011-12-19 21:25:39 +01:00
Jürg Lehni
466857659c
Unroll loop in Path#_setStyles().
2011-12-19 21:23:28 +01:00
Jürg Lehni
12dbb11ec3
Optimise and simplify ellipse code.
2011-12-19 13:51:26 +01:00
Jürg Lehni
3ccb4a6ebe
Fix strokeBounds calculation when a rotation matrix is in use.
...
The bounding box of the rotated pen ellipse was calculated wrongly.
2011-12-19 13:47:30 +01:00
Jürg Lehni
daa1343155
Add comment about perhaps renaming Path.Oval to Path.Ellipse.
2011-12-19 13:16:29 +01:00
Jürg Lehni
83df011e1d
Add missing colon.
2011-12-19 13:16:06 +01:00
Jürg Lehni
9e5eb17264
Improve Item#transform() and implement #applyMatrix() to support nested matrices. Work in progress.
2011-12-18 16:54:21 +01:00
Jürg Lehni
120ead209e
Define Segment#clone().
2011-12-07 11:54:41 +01:00
Jürg Lehni
566aaed0be
Define Segment#equals().
2011-12-07 11:53:07 +01:00
Jürg Lehni
3ece08bea1
Fix handling of recursion in Item#setSelected() / #setFullySelected().
2011-11-30 17:16:52 +01:00
Jürg Lehni
b51cf064b0
Make baseItem to last optional parameter of _getBounds.
2011-11-26 11:55:19 +01:00
Jürg Lehni
f799c85e76
Switch to using 'this' in private getBounds methods to point to path item rather than 'that'.
2011-11-26 11:48:08 +01:00
Jürg Lehni
a0ad81b576
Pass on the baseItem of a getBounds call, required to implement proper caching later.
2011-11-26 11:24:48 +01:00
Jürg Lehni
569c415b2f
Start implementing bounds caching the new way.
...
Work in progress still.
2011-11-24 15:37:44 +01:00
Jürg Lehni
c989d3ee3f
Restructure code a bit for easier reading.
2011-11-24 15:18:57 +01:00
Jürg Lehni
ea87be166e
Part one of big refactoring of bouding box handling. Functional, but caching is broken right now.
2011-11-24 15:13:21 +01:00
Jürg Lehni
b96cd4e1c8
Add comments about possible optimization of accessing of style properties.
2011-11-24 14:53:38 +01:00
Jürg Lehni
3f5e68aa76
Document the private getPendPadding() function.
2011-11-24 10:21:12 +01:00
Jürg Lehni
29aaf38320
Improve comments.
2011-11-24 10:17:31 +01:00
Jürg Lehni
cd1810e6a3
Fix arguments check in Path#getHandleBounds().
2011-11-23 18:13:05 +01:00
Jürg Lehni
b9f6c99dcd
Add comments and clean up code.
2011-11-17 19:28:05 +01:00
Jürg Lehni
c8e1a9c959
Merge remote-tracking branch 'origin/master'
2011-11-12 23:57:39 +01:00
Jürg Lehni
4ba752d42a
Add note and TODO about Path#contains() only working correctly for no-zero winding rule, which is not used by Canvas...
2011-11-12 19:49:12 +01:00
Jürg Lehni
ddf7c6534b
Fix Path#hitTest() to only consider strokeWidth if a strokeColor is provided too.
2011-11-12 19:48:39 +01:00
Jonathan Puckey
52385451f6
Resolve a few documentation todos.
2011-11-12 18:30:21 +01:00
Jonathan Puckey
3ac171a304
Path#smooth() example: select path using fullySelected instead of selected, so we can see its handles.
2011-11-12 16:45:33 +01:00
Jürg Lehni
a326b189b4
Improve Curve#isFlatEnough() by finding the right threshold through testing, and remove other less precise solutions.
2011-11-12 01:23:41 +01:00
Jürg Lehni
d43b54a531
Shorten Curve.isFlatEnough() code.
2011-11-11 20:58:33 +01:00
Jürg Lehni
fdd4ee8d31
Switch back to Kaspar Fischer's version of Curve.isFlatEnough, as it produces the best results with dashed lines.
2011-11-11 20:55:31 +01:00
Jürg Lehni
af9df0e1b8
Provide point of hit handles and segments too in HitResult.
2011-11-11 14:47:03 +01:00
Jürg Lehni
c4bea4d24c
Include comment about algorithm modifications.
2011-11-10 18:30:18 +01:00
Jürg Lehni
3397931bb2
Be consistent in Numerical. EPSILON comparison rules.
2011-09-22 21:14:16 +02:00
Jürg Lehni
571ca31dbf
Move ctx.restore() to same level as ctx.save(). Closes #51 .
2011-09-18 10:56:04 +02:00
Jürg Lehni
4e1dd90549
Use faster Size.create().
2011-08-16 13:52:31 +02:00
Jürg Lehni
4dd90b440e
Use new dontLink parameter for Path.Constructors optimisations.
2011-08-16 13:52:18 +02:00
Jürg Lehni
8f8188a091
Optimise Path.Rectangle constructor.
2011-08-16 13:39:37 +02:00
Jürg Lehni
3c5a46a8af
Implement SegmentPoint#isZero() that does not use the x / y accessors but the internal properties directly, for performance reasons, since it is used a lot internally.
2011-08-16 13:38:52 +02:00
Jürg Lehni
7e0307dd6a
Correct comments.
2011-08-16 13:36:58 +02:00
Jonathan Puckey
3a3f5ecabb
Segment: notify path of change when selection state of handles changes, so the view is redrawn.
2011-08-04 10:54:56 +02:00
Jürg Lehni
a8c08b3301
Docs: Document Path#getNearestLocation() and #getNearestPoint().
2011-08-01 11:48:27 +01:00
Jürg Lehni
7f81184848
Only intersect lines if their lengths are not conflicting with Numerical.EPSILON comparison of the cross product in Line#intersect().
2011-07-30 11:38:17 +01:00
Jürg Lehni
7d0db22b9b
Use squared distances in nearest point algorithm.
2011-07-30 11:37:07 +01:00
Jürg Lehni
3a7c5286b5
Improve precision of Line#intersect() and other parts that check for a divisor to not be 0, by comparing against the new Numerical.EPSILON rather than Numerical.TOLERANCE.
2011-07-28 11:03:59 +01:00
Jonathan Puckey
60a4292691
Fix the way children of CompoundPath have their orientation set by overriding Item#insertChild(index, item).
2011-07-27 20:30:39 +02:00
Jonathan Puckey
63628be923
Fix bug in CompoundPath#draw(ctx, draw) which was causing an error when a compound path didn't have any children.
2011-07-25 21:41:09 +02:00
Jonathan Puckey
53a602fb56
Path#_hitTest: check that a stroke hit test was requested.
2011-07-15 14:50:42 +02:00
Jonathan Puckey
91ab38ffd1
Path#getHandleBounds: remove optimization as it leads to problems when hit testing handles.
2011-07-15 12:58:34 +02:00
Jürg Lehni
a3bfc8fe40
Support all ways of defining a Point in SegmentPoint.create(), through fallback to Point.read().
2011-07-13 12:46:16 +01:00
Jonathan Puckey
ff685f294a
Fix problem with passing a Size to the Segment constructor.
2011-07-13 13:29:50 +02:00
Jürg Lehni
254aee47f8
Implement Path#getLocation(point)
2011-07-09 17:12:27 +02:00
Jürg Lehni
55f815cb72
Remove obsolete TODOs.
2011-07-09 17:12:13 +02:00
Jürg Lehni
45c7f9c4fc
Port back code to prevent tangents and normals of length 0 from Scriptographer.
2011-07-09 11:20:03 +02:00
Jürg Lehni
ebd3bfc092
Introduce faster versions of Rectangle#contains() that do not perform checks.
2011-07-09 11:07:12 +02:00
Jürg Lehni
833d4968ce
Change root solvers to not produce new arrays each time but fill a passed one that can be reused. Yields io impressive performance improvements.
2011-07-09 10:50:47 +02:00
Jürg Lehni
839107d341
Remove faulty code for calculation of tangents / normals.
2011-07-09 10:35:22 +02:00
Jürg Lehni
ec00150df2
Remove unused variable.
2011-07-09 10:34:18 +02:00
Jürg Lehni
4e1d613ed8
Fix Curve#getLength() again for straight lines.
2011-07-09 10:21:17 +02:00
Jürg Lehni
17b412ce6f
Fix a newly introduced bug in #contains().
2011-07-09 10:17:06 +02:00
Jürg Lehni
8a6d53766e
Explain code a litter better.
2011-07-09 10:11:50 +02:00
Jürg Lehni
8928a7b057
Fix #getCrossings() where calling #getPoint() / #getTangent() was slow and also wrong when a matrix was used.
2011-07-09 10:09:41 +02:00
Jürg Lehni
8606f25542
Switch from using Function#apply() trick for passing curve values as function parameters to simply passing arrays and looking up the values on then.
2011-07-09 10:08:43 +02:00
Jürg Lehni
23f38c6e5b
Fix Path#flatten(), where we don't want to add last segment again for closed paths.
2011-07-09 09:51:06 +02:00
Jürg Lehni
74b23c1882
Use #roughBounds rather than #bounds in #contains() check.
2011-07-09 09:27:54 +02:00
Jürg Lehni
0a7f5a12a5
Fix bug in 'stroke' hit-results.
2011-07-08 23:32:29 +02:00
Jürg Lehni
c033a5a7bc
Implement hit-test options: segments, handles and ends.
2011-07-08 23:26:21 +02:00
Jürg Lehni
bb4e71da81
Clean up isFlatEnough() code.
2011-07-08 22:26:22 +02:00
Jürg Lehni
dfbe3135ad
Remove HitResult inheritance from CurveLocation, but have a #location property pointing to it.
2011-07-08 22:25:42 +02:00
Jonathan Puckey
36be78c671
Fix small problem in Item#_hitTest.
2011-07-08 18:41:29 +02:00
Jonathan Puckey
a0f4371803
Fix CurveLocation#getSegment.
2011-07-08 18:39:05 +02:00
Jürg Lehni
fe37ce6bcb
Clean up comments.
2011-07-07 23:02:26 +02:00
Jürg Lehni
23c4499d15
Add comments about how to potentially improve getBounds() accuracy.
2011-07-07 23:00:40 +02:00
Jürg Lehni
ca50461fd1
Implement new Curve.isFlatEnough().
2011-07-07 23:00:16 +02:00
Jürg Lehni
69a7d0bfd4
Implement a first version of Item#hitTest(), so far working only for Path items. Work in progress.
2011-07-07 22:14:58 +02:00
Jürg Lehni
f15a541468
Improve documentation.
2011-07-07 16:10:27 +02:00
Jürg Lehni
64ae48af0b
Remove solved TODO.
2011-07-07 16:10:06 +02:00
Jürg Lehni
5655981f6d
Clean up white spaces.
2011-07-07 16:09:02 +02:00
Jürg Lehni
e573fe5dcd
Do not pass prevSlope to Curve#getCrossings(), rely on #getPrevious() instead.
2011-07-07 16:08:10 +02:00
Jürg Lehni
4a53503130
Add support for optional matrix in Path#contains(), Path#getNearestLocation(), Curve#getValues(), Curve#getCrossings(), Curve#getNearestLocation()
2011-07-07 16:07:29 +02:00
Jürg Lehni
9d2148245a
Implement Curve#getParameter(point), untested.
2011-07-06 23:15:32 +02:00
Jürg Lehni
56d62108cf
Rename PathFlattener#getParameter(offset) -> #getParameterAt(offset)
2011-07-06 23:14:18 +02:00
Jürg Lehni
b13c7622c8
Rename Curve#getParameter(length) -> Curve#getParameterAt(offset)
2011-07-06 23:13:38 +02:00
Jürg Lehni
778a161ba0
Rename Curve.solve() -> Curve.solveCubic()
2011-07-06 23:10:16 +02:00
Jürg Lehni
d6b666024b
Define #getNearestLocation() / #getNearestPoint() for Path.
2011-07-06 22:25:20 +02:00
Jürg Lehni
fadf6e98b5
Pass on minDistance to CurveLocation.
2011-07-06 22:21:49 +02:00
Jürg Lehni
c35133fae9
Add CurveLocation#distance, for Curve#getNearestLocation().
2011-07-06 22:19:01 +02:00
Jürg Lehni
0c0807e3e9
Streamline handling of undefined properties in CurveLocation.
2011-07-06 22:18:40 +02:00
Jürg Lehni
30e92c8a35
Simplify CurveLocation#getPoint(), as missing parameter cannot be determined if point is also undefined.
2011-07-06 22:14:44 +02:00
Jürg Lehni
17bdaf6fe4
Use CurveLocation for Curve#getNearest*() methods.
2011-07-06 22:08:10 +02:00
Jürg Lehni
8b6d9746ce
Rename Curve#getCrossingsFor() -> #getCrossings()
2011-07-06 22:07:34 +02:00
Jürg Lehni
5c3a6f72b6
Fix comments.
2011-07-06 15:31:16 +02:00
Jürg Lehni
ccd4113ba3
Implement Nearest Point-on-Curve Problem.
2011-07-05 13:20:31 +02:00
Jürg Lehni
4630a1bd4a
Fix documentation.
2011-07-05 13:17:34 +02:00
Jürg Lehni
c1f46977fa
Rename Curve.isSufficientlyFlat() to shorter Curve.isFlatEnough()
2011-07-05 13:17:07 +02:00
Jürg Lehni
4110a56521
Improve comments.
2011-07-05 01:20:25 +02:00
Jürg Lehni
6cc7417201
Handle edge case in crossing number algorithm where the beam in right x-direction is touching a tip where the curves change y-direction but do not interesect with the shape, by checking for slope changes.
2011-07-05 01:15:45 +02:00
Jürg Lehni
4924d683e4
Simplify Curve.solve() and improve documentation.
2011-07-04 23:42:16 +02:00
Jürg Lehni
c5269ecbab
Implement Path#contains(point) efficiently using the crossing number algorithm and our cubic polynomial solver.
2011-07-04 23:32:15 +02:00