Define View#matrix, giving access to more fine-grained control over the view transformation.

Relates to #832
This commit is contained in:
Jürg Lehni 2016-01-16 14:25:11 +01:00
parent 2669d06642
commit 7fa013092e

View file

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