mirror of
https://github.com/konvajs/konva.git
synced 2025-11-24 16:53:06 +08:00
minor code cleanup discovered by Wappworks
This commit is contained in:
@@ -307,7 +307,7 @@ Kinetic.Node.prototype = {
|
||||
},
|
||||
/**
|
||||
* set zIndex
|
||||
* @param {int} index
|
||||
* @param {int} zIndex
|
||||
*/
|
||||
setZIndex: function(zIndex) {
|
||||
var index = this.index;
|
||||
@@ -405,7 +405,7 @@ Kinetic.Node.prototype = {
|
||||
},
|
||||
/**
|
||||
* move node to another container
|
||||
* @param {Layer} newLayer
|
||||
* @param {Container} newContainer
|
||||
*/
|
||||
moveTo: function(newContainer) {
|
||||
var parent = this.parent;
|
||||
@@ -522,4 +522,4 @@ Kinetic.Node.prototype = {
|
||||
*/
|
||||
handle(this);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
10
src/Shape.js
10
src/Shape.js
@@ -31,11 +31,11 @@ Kinetic.Shape = function(config) {
|
||||
*/
|
||||
Kinetic.Shape.prototype = {
|
||||
/**
|
||||
* get layer context where the shape is being drawn. When
|
||||
* the shape is being rendered, .getContext() returns the context of the
|
||||
* user created layer that contains the shape. When the event detection
|
||||
* engine is determining whether or not an event has occured on that shape,
|
||||
* .getContext() returns the context of the invisible backstage layer.
|
||||
* get layer context where the shape is being drawn. When
|
||||
* the shape is being rendered, .getContext() returns the context of the
|
||||
* user created layer that contains the shape. When the event detection
|
||||
* engine is determining whether or not an event has occured on that shape,
|
||||
* .getContext() returns the context of the invisible backstage layer.
|
||||
*/
|
||||
getContext: function() {
|
||||
return this.tempLayer.getContext();
|
||||
|
||||
@@ -42,7 +42,7 @@ Kinetic.Image.prototype = {
|
||||
/**
|
||||
* get image
|
||||
*/
|
||||
getImage: function(image) {
|
||||
getImage: function() {
|
||||
return this.image;
|
||||
},
|
||||
/**
|
||||
@@ -82,4 +82,4 @@ Kinetic.Image.prototype = {
|
||||
}
|
||||
};
|
||||
// extend Shape
|
||||
Kinetic.GlobalObject.extend(Kinetic.Image, Kinetic.Shape);
|
||||
Kinetic.GlobalObject.extend(Kinetic.Image, Kinetic.Shape);
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
*/
|
||||
Kinetic.Rect = function(config) {
|
||||
config.drawFunc = function() {
|
||||
var canvas = this.getCanvas();
|
||||
var context = this.getContext();
|
||||
context.beginPath();
|
||||
context.rect(0, 0, this.width, this.height);
|
||||
@@ -61,4 +60,4 @@ Kinetic.Rect.prototype = {
|
||||
};
|
||||
|
||||
// extend Shape
|
||||
Kinetic.GlobalObject.extend(Kinetic.Rect, Kinetic.Shape);
|
||||
Kinetic.GlobalObject.extend(Kinetic.Rect, Kinetic.Shape);
|
||||
|
||||
@@ -29,7 +29,6 @@ Kinetic.Text = function(config) {
|
||||
}
|
||||
|
||||
config.drawFunc = function() {
|
||||
var canvas = this.getCanvas();
|
||||
var context = this.getContext();
|
||||
context.font = this.fontSize + "pt " + this.fontFamily;
|
||||
context.textBaseline = "middle";
|
||||
@@ -212,4 +211,4 @@ Kinetic.Text.prototype = {
|
||||
}
|
||||
};
|
||||
// extend Shape
|
||||
Kinetic.GlobalObject.extend(Kinetic.Text, Kinetic.Shape);
|
||||
Kinetic.GlobalObject.extend(Kinetic.Text, Kinetic.Shape);
|
||||
|
||||
Reference in New Issue
Block a user