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

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

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