Commit graph

4971 commits

Author SHA1 Message Date
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
Jürg Lehni
86f6d8eccd Fix crash in unit tests. 2016-01-26 23:27:38 +01:00
Jürg Lehni
4af8999135 Clean up View#_handleFrame() 2016-01-26 22:35:46 +01:00
Jürg Lehni
b71ffdbe71 Remove all direct calls to view.update() and favor of the new view.requestUpdate()
Pure window.requestAnimationFrame() smoothness, automatic updates even when working directly from JavaScript, and no more slow-downs from onLoad events!

Closes #830, #925
2016-01-26 21:37:27 +01:00
Jürg Lehni
9ad63a7231 Merge branch 'unified-version' into develop 2016-01-26 21:06:54 +01:00
Jürg Lehni
5e69de3bd1 Restructure event handling on Raster item.
- Trigger #onLoad() events from Raster#setImage() also
- Add support for Raster#onError() handler
Closes #849 and #924
2016-01-26 21:06:36 +01:00