mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-05 20:32:00 -05:00
Merge remote branch 'origin/master'
This commit is contained in:
commit
b5cc2e9334
4 changed files with 16 additions and 8 deletions
|
@ -39,14 +39,10 @@
|
||||||
mouseDown = false;
|
mouseDown = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
function onFrame() {
|
|
||||||
iterate();
|
|
||||||
}
|
|
||||||
|
|
||||||
var grow = false;
|
var grow = false;
|
||||||
var vector = new Point(150, 0);
|
var vector = new Point(150, 0);
|
||||||
|
|
||||||
function iterate() {
|
function onFrame() {
|
||||||
for (var i = 0, l = gradient.stops.length; i < l; i++)
|
for (var i = 0, l = gradient.stops.length; i < l; i++)
|
||||||
gradient.stops[i].color.hue -= 20;
|
gradient.stops[i].color.hue -= 20;
|
||||||
if (grow && vector.length > 300) {
|
if (grow && vector.length > 300) {
|
||||||
|
|
|
@ -70,8 +70,9 @@ var DomElement = new function() {
|
||||||
isVisible: function(el) {
|
isVisible: function(el) {
|
||||||
// See if the scrolled bounds intersect with the windows rectangle
|
// See if the scrolled bounds intersect with the windows rectangle
|
||||||
// which always starts at 0, 0
|
// which always starts at 0, 0
|
||||||
return new Rectangle([0, 0], DomElement.getWindowSize())
|
return !DomElement.isInvisible(el)
|
||||||
.intersects(DomElement.getBounds(el, false, true));
|
&& new Rectangle([0, 0], DomElement.getWindowSize())
|
||||||
|
.intersects(DomElement.getBounds(el, false, true));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -70,7 +70,7 @@ var Key = this.Key = new function() {
|
||||||
key = keys[keyCode] || character.toLowerCase(),
|
key = keys[keyCode] || character.toLowerCase(),
|
||||||
handler = down ? 'onKeyDown' : 'onKeyUp',
|
handler = down ? 'onKeyDown' : 'onKeyUp',
|
||||||
view = View.focused,
|
view = View.focused,
|
||||||
scope = view && view._scope,
|
scope = view && view.isVisible() && view._scope,
|
||||||
tool = scope && scope.tool;
|
tool = scope && scope.tool;
|
||||||
keyMap[key] = down;
|
keyMap[key] = down;
|
||||||
if (tool && tool[handler]) {
|
if (tool && tool[handler]) {
|
||||||
|
|
|
@ -193,6 +193,17 @@ var View = this.View = Base.extend({
|
||||||
this._zoom = zoom;
|
this._zoom = zoom;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks whether the view is currently visible within the current browser
|
||||||
|
* viewport.
|
||||||
|
*
|
||||||
|
* @return {Boolean} Whether the view is visible.
|
||||||
|
*/
|
||||||
|
isVisible: function() {
|
||||||
|
// TODO: Take bounds into account if it's not the full canvas?
|
||||||
|
return DomElement.isVisible(this._canvas);
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {Point} point
|
* @param {Point} point
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in a new issue