Use inject() instead of a each() loop to add values to HitResult, so getters can be defined too (required for raster hit testing).

This commit is contained in:
Jürg Lehni 2011-11-11 13:11:10 +01:00
parent e2eec3476d
commit 1124236b8a

View file

@ -25,13 +25,11 @@ HitResult = Base.extend(/** @lends HitResult# */{
initialize: function(type, item, values) {
this.type = type;
this.item = item;
if (values) {
// Copy over passed values, depending on use case.
// DOCS: HitResult#location, #segment, #name, #point
Base.each(values, function(value, key) {
this[key] = value;
}, this);
}
// Inject passed values, so we can be flexible about the HitResult
// properties.
// This allows the definition of getters too, e.g. for 'pixel'.
if (values)
this.inject(values);
},
/**