Merge branch 'master' of github.com:scriptographer/paper.js

This commit is contained in:
Jonathan Puckey 2011-06-14 12:24:34 +02:00
commit b55bb1b942
5 changed files with 28 additions and 12 deletions

View file

@ -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
if [ $MODE == "docs" ]
then
# Build paper.js library for documentation
./preprocess.sh ../src/paper.js ../dist/docs/resources/js/paper.js \
"-DBROWSER" stripped
fi

@ -1 +1 @@
Subproject commit 4d1f37f9e2ea64ba0055d044c65921bc21dcb7b3
Subproject commit a3ad75a0629428accb0e940849069bedb253a89c

View file

@ -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

View file

@ -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) {