1 goog.provide('lime.Layer'); 2 3 4 goog.require('lime'); 5 goog.require('lime.Node'); 6 7 /** 8 * Layer object. This object has no visible body itself but 9 * acts as a container for other objects. Setting position/scale etc 10 * changes position/scale of all of its children 11 * @constructor 12 * @extends lime.Node 13 */ 14 lime.Layer = function() { 15 lime.Node.call(this); 16 17 this.domClassName = goog.getCssName('lime-layer'); 18 }; 19 goog.inherits(lime.Layer, lime.Node); 20 21 22 /** 23 * @inheritDoc 24 */ 25 lime.Layer.prototype.hitTest = function(e) { 26 //Layers hittest returns true if ony of its childrens hittest returns true 27 28 //todo: this can be optimized 29 for (var i = 0, child; child = this.children_[i]; i++) { 30 31 if (child.hitTest(e)) { 32 e.position = this.screenToLocal(e.screenPosition); 33 return true; 34 } 35 36 } 37 38 return false; 39 40 }; 41 42