mirror of
https://github.com/konvajs/konva.git
synced 2025-06-28 15:23:44 +08:00
undid last commit. I pulled in a commit from another fork which makes the isPointInPath extensible, but then realized that this doesn't really have a usage outside of my current path detection algo because the backstage layer needs to be redrawn each time
This commit is contained in:
parent
79c778ebff
commit
fc743d1442
16
dist/kinetic-core.js
vendored
16
dist/kinetic-core.js
vendored
@ -1218,16 +1218,18 @@ Kinetic.Stage.prototype = {
|
|||||||
_detectEvent: function(shape, evt) {
|
_detectEvent: function(shape, evt) {
|
||||||
var isDragging = Kinetic.GlobalObject.drag.moving;
|
var isDragging = Kinetic.GlobalObject.drag.moving;
|
||||||
var backstageLayer = this.backstageLayer;
|
var backstageLayer = this.backstageLayer;
|
||||||
|
var backstageLayerContext = backstageLayer.getContext();
|
||||||
var go = Kinetic.GlobalObject;
|
var go = Kinetic.GlobalObject;
|
||||||
var pos = this.getUserPosition();
|
var pos = this.getUserPosition();
|
||||||
var el = shape.eventListeners;
|
var el = shape.eventListeners;
|
||||||
|
|
||||||
|
shape._draw(backstageLayer);
|
||||||
|
|
||||||
if(this.targetShape && shape.id === this.targetShape.id) {
|
if(this.targetShape && shape.id === this.targetShape.id) {
|
||||||
this.targetFound = true;
|
this.targetFound = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(shape.visible && pos !== undefined && shape.isPointInShape(backstageLayer,pos)) {
|
if(shape.visible && pos !== undefined && backstageLayerContext.isPointInPath(pos.x, pos.y)) {
|
||||||
// handle onmousedown
|
// handle onmousedown
|
||||||
if(!isDragging && this.mouseDown) {
|
if(!isDragging && this.mouseDown) {
|
||||||
this.mouseDown = false;
|
this.mouseDown = false;
|
||||||
@ -1858,14 +1860,6 @@ Kinetic.Shape = function(config) {
|
|||||||
* Shape methods
|
* Shape methods
|
||||||
*/
|
*/
|
||||||
Kinetic.Shape.prototype = {
|
Kinetic.Shape.prototype = {
|
||||||
/**
|
|
||||||
* isPointInShape
|
|
||||||
*/
|
|
||||||
isPointInShape: function(backstageLayer,pos){
|
|
||||||
var backstageLayerContext = backstageLayer.getContext();
|
|
||||||
this._draw(backstageLayer);
|
|
||||||
return backstageLayerContext.isPointInPath(pos.x,pos.y);
|
|
||||||
},
|
|
||||||
/**
|
/**
|
||||||
* get layer context where the shape is being drawn. When
|
* get layer context where the shape is being drawn. When
|
||||||
* the shape is being rendered, .getContext() returns the context of the
|
* the shape is being rendered, .getContext() returns the context of the
|
||||||
@ -2487,9 +2481,7 @@ Kinetic.Text.prototype = {
|
|||||||
return this.fontSize;
|
return this.fontSize;
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* set font style using same rules as the first argument for the css spec's shorthand font property:
|
* set font style. Can be "normal", "italic", or "bold". "normal" is the default.
|
||||||
* http://www.w3.org/TR/CSS21/fonts.html#propdef-font
|
|
||||||
* i.e. [ <'font-style'> || <'font-variant'> || <'font-weight'> ]
|
|
||||||
* @param {String} fontStyle
|
* @param {String} fontStyle
|
||||||
*/
|
*/
|
||||||
setFontStyle: function(fontStyle) {
|
setFontStyle: function(fontStyle) {
|
||||||
|
@ -31,14 +31,6 @@ Kinetic.Shape = function(config) {
|
|||||||
* Shape methods
|
* Shape methods
|
||||||
*/
|
*/
|
||||||
Kinetic.Shape.prototype = {
|
Kinetic.Shape.prototype = {
|
||||||
/**
|
|
||||||
* isPointInShape
|
|
||||||
*/
|
|
||||||
isPointInShape: function(backstageLayer,pos){
|
|
||||||
var backstageLayerContext = backstageLayer.getContext();
|
|
||||||
this._draw(backstageLayer);
|
|
||||||
return backstageLayerContext.isPointInPath(pos.x,pos.y);
|
|
||||||
},
|
|
||||||
/**
|
/**
|
||||||
* get layer context where the shape is being drawn. When
|
* get layer context where the shape is being drawn. When
|
||||||
* the shape is being rendered, .getContext() returns the context of the
|
* the shape is being rendered, .getContext() returns the context of the
|
||||||
|
@ -238,16 +238,18 @@ Kinetic.Stage.prototype = {
|
|||||||
_detectEvent: function(shape, evt) {
|
_detectEvent: function(shape, evt) {
|
||||||
var isDragging = Kinetic.GlobalObject.drag.moving;
|
var isDragging = Kinetic.GlobalObject.drag.moving;
|
||||||
var backstageLayer = this.backstageLayer;
|
var backstageLayer = this.backstageLayer;
|
||||||
|
var backstageLayerContext = backstageLayer.getContext();
|
||||||
var go = Kinetic.GlobalObject;
|
var go = Kinetic.GlobalObject;
|
||||||
var pos = this.getUserPosition();
|
var pos = this.getUserPosition();
|
||||||
var el = shape.eventListeners;
|
var el = shape.eventListeners;
|
||||||
|
|
||||||
|
shape._draw(backstageLayer);
|
||||||
|
|
||||||
if(this.targetShape && shape.id === this.targetShape.id) {
|
if(this.targetShape && shape.id === this.targetShape.id) {
|
||||||
this.targetFound = true;
|
this.targetFound = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(shape.visible && pos !== undefined && shape.isPointInShape(backstageLayer,pos)) {
|
if(shape.visible && pos !== undefined && backstageLayerContext.isPointInPath(pos.x, pos.y)) {
|
||||||
// handle onmousedown
|
// handle onmousedown
|
||||||
if(!isDragging && this.mouseDown) {
|
if(!isDragging && this.mouseDown) {
|
||||||
this.mouseDown = false;
|
this.mouseDown = false;
|
||||||
|
Loading…
Reference in New Issue
Block a user