changed other instances of imageBuffer to imageHitRegion

This commit is contained in:
Eric Rowell
2012-11-28 23:28:24 -08:00
parent 94670aeeda
commit 44e454d740
2 changed files with 12 additions and 12 deletions

View File

@@ -65,10 +65,10 @@ Kinetic.Image.prototype = {
}, },
drawHitFunc: function(context) { drawHitFunc: function(context) {
var width = this.getWidth(), height = this.getHeight(), imageBuffer = this.imageBuffer, appliedShadow = false; var width = this.getWidth(), height = this.getHeight(), imageHitRegion = this.imageHitRegion, appliedShadow = false;
if(imageBuffer) { if(imageHitRegion) {
this.drawImage(context, this.imageBuffer, 0, 0, width, height); this.drawImage(context, imageHitRegion, 0, 0, width, height);
context.beginPath(); context.beginPath();
context.rect(0, 0, width, height); context.rect(0, 0, width, height);
@@ -130,12 +130,12 @@ Kinetic.Image.prototype = {
this.setAttr('crop', Kinetic.Type._merge(both, this.getCrop())); this.setAttr('crop', Kinetic.Type._merge(both, this.getCrop()));
}, },
/** /**
* create image buffer which enables more accurate hit detection mapping of the image * create image hit region which enables more accurate hit detection mapping of the image
* by avoiding event detections for transparent pixels * by avoiding event detections for transparent pixels
* @name createImageHitRegion * @name createImageHitRegion
* @methodOf Kinetic.Image.prototype * @methodOf Kinetic.Image.prototype
* @param {Function} [callback] callback function to be called once * @param {Function} [callback] callback function to be called once
* the buffer image has been created and set * the image hit region has been created
*/ */
createImageHitRegion: function(callback) { createImageHitRegion: function(callback) {
var canvas = new Kinetic.Canvas(this.attrs.width, this.attrs.height); var canvas = new Kinetic.Canvas(this.attrs.width, this.attrs.height);
@@ -155,23 +155,23 @@ Kinetic.Image.prototype = {
var that = this; var that = this;
Kinetic.Type._getImage(imageData, function(imageObj) { Kinetic.Type._getImage(imageData, function(imageObj) {
that.imageBuffer = imageObj; that.imageHitRegion = imageObj;
if(callback) { if(callback) {
callback(); callback();
} }
}); });
} }
catch(e) { catch(e) {
Kinetic.Global.warn('Unable to create image buffer. ' + e.message); Kinetic.Global.warn('Unable to create image hit region. ' + e.message);
} }
}, },
/** /**
* clear buffer image * clear image hit region
* @name clearImageBuffer * @name clearImageHitRegion
* @methodOf Kinetic.Image.prototype * @methodOf Kinetic.Image.prototype
*/ */
clearImageBuffer: function() { clearImageHitRegion: function() {
delete this.imageBuffer; delete this.imageHitRegion;
}, },
_syncSize: function() { _syncSize: function() {
if(this.attrs.image) { if(this.attrs.image) {

View File

@@ -121,7 +121,7 @@ Test.Modules.IMAGE = {
}; };
imageObj.src = '../assets/darth-vader.jpg'; imageObj.src = '../assets/darth-vader.jpg';
}, },
'create image buffer': function(containerId) { 'create image hit region': function(containerId) {
var imageObj = new Image(); var imageObj = new Image();
var stage = new Kinetic.Stage({ var stage = new Kinetic.Stage({