Merge remote-tracking branch 'origin/master'

This commit is contained in:
Jürg Lehni 2011-11-11 18:29:44 +01:00
commit eaa5f97e95
2 changed files with 24 additions and 1 deletions

View file

@ -39,7 +39,7 @@ HitResult = Base.extend(/** @lends HitResult# */{
* @property
* @name HitResult#type
* @type String('segment', 'handle-in', 'handle-out', 'stroke', 'fill',
* 'bounds', 'center')
* 'bounds', 'center', 'pixel')
*/
/**
@ -69,6 +69,15 @@ HitResult = Base.extend(/** @lends HitResult# */{
* @type CurveLocation
*/
/**
* If the HitResult has a type of 'pixel', this property refers to the color
* of the pixel on the {@link Raster} that was hit.
*
* @property
* @name HitResult#color
* @type RgbColor
*/
/**
* If the HitResult has a type of 'stroke', 'segment', 'handle-in' or
* 'handle-out', this property refers to the Segment that was hit or that

View file

@ -397,6 +397,20 @@ var Raster = this.Raster = PlacedItem.extend(/** @lends Raster# */{
return this.getStrokeBounds(arguments[0]);
},
_hitTest: function(point, options) {
point = this._matrix._inverseTransform(point);
if (point.isInside(new Rectangle(this._size).setCenter(0, 0))) {
var that = this;
return new HitResult('pixel', that, {
offset: point.add(that._size.divide(2)).round(),
// Becomes HitResult#color
getColor: function() {
return that.getPixel(this.offset);
}
});
}
},
draw: function(ctx, param) {
if (param.selection) {
var bounds = new Rectangle(this._size).setCenter(0, 0);