mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-19 14:10:14 -05:00
Define View#matrix, giving access to more fine-grained control over the view transformation.
Relates to #832
This commit is contained in:
parent
2669d06642
commit
7fa013092e
1 changed files with 20 additions and 1 deletions
|
@ -265,7 +265,7 @@ var View = Base.extend(Emitter, /** @lends View# */{
|
|||
* @param {ChangeFlag} flags describes what exactly has changed
|
||||
*/
|
||||
_changed: function(flags) {
|
||||
this._project._changed(flats);
|
||||
this._project._changed(flags);
|
||||
},
|
||||
|
||||
_transform: function(matrix) {
|
||||
|
@ -402,6 +402,25 @@ var View = Base.extend(Emitter, /** @lends View# */{
|
|||
this._zoom = zoom;
|
||||
},
|
||||
|
||||
/**
|
||||
* The view's transformation matrix, defining the view onto the project's
|
||||
* contents (position, zoom level, rotation, etc).
|
||||
*
|
||||
* @bean
|
||||
* @type Matrix
|
||||
*/
|
||||
getMatrix: function() {
|
||||
return this._matrix;
|
||||
},
|
||||
|
||||
setMatrix: function() {
|
||||
// Use Matrix#initialize to easily copy over values.
|
||||
// NOTE: calling initialize() also calls #_changed() for us, through its
|
||||
// call to #set() / #reset(), and this also handles _applyMatrix for us.
|
||||
var matrix = this._matrix;
|
||||
matrix.initialize.apply(matrix, arguments);
|
||||
},
|
||||
|
||||
/**
|
||||
* Checks whether the view is currently visible within the current browser
|
||||
* viewport.
|
||||
|
|
Loading…
Reference in a new issue