mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-03-15 01:09:53 -04:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
eaa5f97e95
2 changed files with 24 additions and 1 deletions
|
@ -39,7 +39,7 @@ HitResult = Base.extend(/** @lends HitResult# */{
|
||||||
* @property
|
* @property
|
||||||
* @name HitResult#type
|
* @name HitResult#type
|
||||||
* @type String('segment', 'handle-in', 'handle-out', 'stroke', 'fill',
|
* @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
|
* @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
|
* 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
|
* 'handle-out', this property refers to the Segment that was hit or that
|
||||||
|
|
|
@ -397,6 +397,20 @@ var Raster = this.Raster = PlacedItem.extend(/** @lends Raster# */{
|
||||||
return this.getStrokeBounds(arguments[0]);
|
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) {
|
draw: function(ctx, param) {
|
||||||
if (param.selection) {
|
if (param.selection) {
|
||||||
var bounds = new Rectangle(this._size).setCenter(0, 0);
|
var bounds = new Rectangle(this._size).setCenter(0, 0);
|
||||||
|
|
Loading…
Reference in a new issue