mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-20 22:39:50 -05:00
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:
parent
e2eec3476d
commit
1124236b8a
1 changed files with 5 additions and 7 deletions
|
@ -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);
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue