From a3d187597177b2c6646eff23e8cfbff20443ecac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrg=20Lehni?= Date: Mon, 13 Jun 2011 19:09:10 +0100 Subject: [PATCH 1/6] More clean ups. --- src/path/Path.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/path/Path.js b/src/path/Path.js index 8bb2a948..eeaf59b6 100644 --- a/src/path/Path.js +++ b/src/path/Path.js @@ -1014,7 +1014,7 @@ var Path = this.Path = PathItem.extend({ var loc = this.getLocationAt(offset, isParameter); return loc && loc.getPoint(); }, - + /** * Get the tangent to the path at the given offset as a vector * point. @@ -1083,7 +1083,7 @@ var Path = this.Path = PathItem.extend({ var loc = this.getLocationAt(offset, isParameter); return loc && loc.getTangent(); }, - + /** * Get the normal to the path at the given offset as a vector point. * @@ -1189,7 +1189,7 @@ var Path = this.Path = PathItem.extend({ } } } - + function drawHandle(ctx, point, handle) { if (!handle.isZero()) { var handleX = point._x + handle._x, @@ -2188,7 +2188,7 @@ var Path = this.Path = PathItem.extend({ getControlBounds: function() { // TODO: Implement! } - + // TODO: intersects(item) // TODO: contains(item) // TODO: contains(point) From fbf7016e7cd792d07a8835a014190653c95436a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrg=20Lehni?= Date: Mon, 13 Jun 2011 19:32:20 +0100 Subject: [PATCH 2/6] Update JsDoc. --- build/jsdoc-toolkit | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/jsdoc-toolkit b/build/jsdoc-toolkit index 4d1f37f9..e4c36832 160000 --- a/build/jsdoc-toolkit +++ b/build/jsdoc-toolkit @@ -1 +1 @@ -Subproject commit 4d1f37f9e2ea64ba0055d044c65921bc21dcb7b3 +Subproject commit e4c36832060eeeab57e8b850570ae8d2238a5e08 From c4d0d80f3b6ce6cbdc1af7e987de60b8eee1bce7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrg=20Lehni?= Date: Mon, 13 Jun 2011 23:50:43 +0100 Subject: [PATCH 3/6] Only build paper.js library for docs, not for server templates. --- build/docs.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/build/docs.sh b/build/docs.sh index 4c0c7f21..082132e8 100755 --- a/build/docs.sh +++ b/build/docs.sh @@ -26,5 +26,9 @@ cd jsdoc-toolkit java -jar jsrun.jar app/run.js -c=conf/$MODE.conf -D="renderMode:$MODE" cd .. -#build paper.js library for documentation -./preprocess.sh ../src/paper.js ../dist/docs/resources/js/paper.js "-DBROWSER" stripped \ No newline at end of file +if [ $MODE == "docs" ] +then + # Build paper.js library for documentation + ./preprocess.sh ../src/paper.js ../dist/docs/resources/js/paper.js \ + "-DBROWSER" stripped +fi From 570fa4fbebbbabb3776ca5f535d22ba5fa0f7af1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrg=20Lehni?= Date: Mon, 13 Jun 2011 23:51:26 +0100 Subject: [PATCH 4/6] Update JsDoc. --- build/jsdoc-toolkit | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/jsdoc-toolkit b/build/jsdoc-toolkit index e4c36832..a3ad75a0 160000 --- a/build/jsdoc-toolkit +++ b/build/jsdoc-toolkit @@ -1 +1 @@ -Subproject commit e4c36832060eeeab57e8b850570ae8d2238a5e08 +Subproject commit a3ad75a0629428accb0e940849069bedb253a89c From eec7209a5c1d57546496f1fd589c7ad76731ba64 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrg=20Lehni?= Date: Tue, 14 Jun 2011 00:20:27 +0100 Subject: [PATCH 5/6] Define DomElement.isInvisible(), to check if the given element is not displaying. --- src/browser/DomElement.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/browser/DomElement.js b/src/browser/DomElement.js index 132246d8..b1d2cec8 100644 --- a/src/browser/DomElement.js +++ b/src/browser/DomElement.js @@ -57,7 +57,16 @@ var DomElement = new function() { ); }, - // Checks if element is visibile in current viewport + /** + * Checks if element is invisibile (display: none, ...) + */ + isInvisible: function(el) { + return DomElement.getSize(el).equals([0, 0]); + }, + + /** + * Checks if element is visibile in current viewport + */ isVisible: function(el) { // See if the scrolled bounds intersect with the windows rectangle // which always starts at 0, 0 From bac579d85bf6fd2c896d253457718adc06d9ae05 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrg=20Lehni?= Date: Tue, 14 Jun 2011 00:20:58 +0100 Subject: [PATCH 6/6] Use a different strategy to determine canvas size for invisible canvases. --- src/ui/View.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/ui/View.js b/src/ui/View.js index d7793857..47787edb 100644 --- a/src/ui/View.js +++ b/src/ui/View.js @@ -49,9 +49,9 @@ var View = this.View = Base.extend({ var that = this; DomEvent.add(window, { resize: function(event) { - // Only get canvas offset if it's not invisible (size is - // 0, 0), as otherwise the offset would be wrong. - if (!DomElement.getSize(canvas).equals([0, 0])) + // Only get canvas offset if it's not invisible, as + // otherwise the offset would be wrong. + if (!DomElement.isInvisible(canvas)) offset = DomElement.getOffset(canvas); // Set the size now, which internally calls onResize that.setViewSize( @@ -66,7 +66,10 @@ var View = this.View = Base.extend({ } }); } else { - size = Size.create(canvas.offsetWidth, canvas.offsetHeight); + size = DomElement.isInvisible(canvas) + ? Size.create(parseInt(canvas.getAttribute('width')), + parseInt(canvas.getAttribute('height'))) + : DomElement.getSize(canvas); } // TODO: Test this on IE: if (canvas.attributes.stats) {