mirror of
https://github.com/konvajs/konva.git
synced 2025-06-28 06:55:17 +08:00
rounding pos components when used with getImageData
This commit is contained in:
parent
79a1029adb
commit
89611aed5f
13
dist/kinetic-core.js
vendored
13
dist/kinetic-core.js
vendored
@ -560,15 +560,6 @@ Kinetic.Canvas.prototype = {
|
||||
this.setWidth(width);
|
||||
this.setHeight(height);
|
||||
},
|
||||
/**
|
||||
* strip away all functions that draw pixels onto the bitmap
|
||||
* @name strip
|
||||
* @methodOf Kinetic.Canvas.prototype
|
||||
* @param {CanvasContext} context
|
||||
*/
|
||||
strip: function() {
|
||||
var context = this.context;
|
||||
},
|
||||
/**
|
||||
* toDataURL
|
||||
*/
|
||||
@ -3032,7 +3023,7 @@ Kinetic.Stage.prototype = {
|
||||
*/
|
||||
for(var n = layers.length - 1; n >= 0; n--) {
|
||||
var layer = layers[n];
|
||||
var p = layer.bufferCanvas.context.getImageData(pos.x, pos.y, 1, 1).data;
|
||||
var p = layer.bufferCanvas.context.getImageData(Math.round(pos.x), Math.round(pos.y), 1, 1).data;
|
||||
// this indicates that a buffer pixel may have been found
|
||||
if(p[3] === 255) {
|
||||
var colorKey = Kinetic.Type._rgbToHex(p[0], p[1], p[2]);
|
||||
@ -4090,7 +4081,7 @@ Kinetic.Shape.prototype = {
|
||||
var bufferCanvas = stage.bufferCanvas;
|
||||
bufferCanvas.clear();
|
||||
this._draw(bufferCanvas);
|
||||
var p = bufferCanvas.context.getImageData(pos.x, pos.y, 1, 1).data;
|
||||
var p = bufferCanvas.context.getImageData(Math.round(pos.x), Math.round(pos.y), 1, 1).data;
|
||||
return p[3] > 0;
|
||||
},
|
||||
__draw: function(canvas) {
|
||||
|
4
dist/kinetic-core.min.js
vendored
4
dist/kinetic-core.min.js
vendored
File diff suppressed because one or more lines are too long
@ -332,7 +332,7 @@ Kinetic.Shape.prototype = {
|
||||
var bufferCanvas = stage.bufferCanvas;
|
||||
bufferCanvas.clear();
|
||||
this._draw(bufferCanvas);
|
||||
var p = bufferCanvas.context.getImageData(pos.x, pos.y, 1, 1).data;
|
||||
var p = bufferCanvas.context.getImageData(Math.round(pos.x), Math.round(pos.y), 1, 1).data;
|
||||
return p[3] > 0;
|
||||
},
|
||||
__draw: function(canvas) {
|
||||
|
@ -364,7 +364,7 @@ Kinetic.Stage.prototype = {
|
||||
*/
|
||||
for(var n = layers.length - 1; n >= 0; n--) {
|
||||
var layer = layers[n];
|
||||
var p = layer.bufferCanvas.context.getImageData(pos.x, pos.y, 1, 1).data;
|
||||
var p = layer.bufferCanvas.context.getImageData(Math.round(pos.x), Math.round(pos.y), 1, 1).data;
|
||||
// this indicates that a buffer pixel may have been found
|
||||
if(p[3] === 255) {
|
||||
var colorKey = Kinetic.Type._rgbToHex(p[0], p[1], p[2]);
|
||||
|
@ -84,15 +84,6 @@ Kinetic.Canvas.prototype = {
|
||||
this.setWidth(width);
|
||||
this.setHeight(height);
|
||||
},
|
||||
/**
|
||||
* strip away all functions that draw pixels onto the bitmap
|
||||
* @name strip
|
||||
* @methodOf Kinetic.Canvas.prototype
|
||||
* @param {CanvasContext} context
|
||||
*/
|
||||
strip: function() {
|
||||
var context = this.context;
|
||||
},
|
||||
/**
|
||||
* toDataURL
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user