Implement view hints architecture
This commit is contained in:
@@ -23,7 +23,8 @@ goog.require('ol.layer.LayerState');
|
||||
* size: ol.Size,
|
||||
* tileQueue: ol.TileQueue,
|
||||
* time: number,
|
||||
* view2DState: ol.View2DState}}
|
||||
* view2DState: ol.View2DState,
|
||||
* viewHints: Array.<number>}}
|
||||
*/
|
||||
ol.FrameState;
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ goog.require('goog.asserts');
|
||||
goog.require('ol.Coordinate');
|
||||
goog.require('ol.MapBrowserEvent');
|
||||
goog.require('ol.View2D');
|
||||
goog.require('ol.ViewHint');
|
||||
goog.require('ol.interaction.ConditionType');
|
||||
goog.require('ol.interaction.Drag');
|
||||
|
||||
|
||||
@@ -585,6 +585,7 @@ ol.Map.prototype.renderFrame_ = function(time) {
|
||||
if (goog.isDef(layersArray) && goog.isDef(size) && goog.isDef(view2D) &&
|
||||
view2D.isDef()) {
|
||||
var backgroundColor = this.getBackgroundColor();
|
||||
var viewHints = view.getHints();
|
||||
var layerStates = {};
|
||||
goog.array.forEach(layersArray, function(layer) {
|
||||
layerStates[goog.getUid(layer)] = layer.getLayerState();
|
||||
@@ -601,6 +602,7 @@ ol.Map.prototype.renderFrame_ = function(time) {
|
||||
size: size,
|
||||
tileQueue: this.tileQueue_,
|
||||
view2DState: view2DState,
|
||||
viewHints: viewHints,
|
||||
time: time
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,10 +1,19 @@
|
||||
goog.provide('ol.View');
|
||||
goog.provide('ol.ViewHint');
|
||||
|
||||
goog.require('ol.IView');
|
||||
goog.require('ol.IView2D');
|
||||
goog.require('ol.IView3D');
|
||||
|
||||
|
||||
/**
|
||||
* @enum {number}
|
||||
*/
|
||||
ol.ViewHint = {
|
||||
PANNING: 0
|
||||
};
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
@@ -12,10 +21,25 @@ goog.require('ol.IView3D');
|
||||
* @extends {ol.Object}
|
||||
*/
|
||||
ol.View = function() {
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {Array.<number>}
|
||||
*/
|
||||
this.hints_ = [0];
|
||||
|
||||
};
|
||||
goog.inherits(ol.View, ol.Object);
|
||||
|
||||
|
||||
/**
|
||||
* @return {Array.<number>} Hint.
|
||||
*/
|
||||
ol.View.prototype.getHints = function() {
|
||||
return this.hints_;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
@@ -27,3 +51,13 @@ ol.View.prototype.getView2D = goog.abstractMethod;
|
||||
*/
|
||||
ol.View.prototype.getView3D = goog.abstractMethod;
|
||||
|
||||
|
||||
/**
|
||||
* @param {ol.ViewHint} hint Hint.
|
||||
* @param {number} delta Delta.
|
||||
*/
|
||||
ol.View.prototype.setHint = function(hint, delta) {
|
||||
goog.asserts.assert(0 <= hint && hint < this.hints_.length);
|
||||
this.hints_[hint] += delta;
|
||||
goog.asserts.assert(this.hints_[hint] >= 0);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user