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 diff --git a/build/jsdoc-toolkit b/build/jsdoc-toolkit index 4d1f37f9..a3ad75a0 160000 --- a/build/jsdoc-toolkit +++ b/build/jsdoc-toolkit @@ -1 +1 @@ -Subproject commit 4d1f37f9e2ea64ba0055d044c65921bc21dcb7b3 +Subproject commit a3ad75a0629428accb0e940849069bedb253a89c 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 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) 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) {