minor code cleanup discovered by Wappworks

This commit is contained in:
Eric Rowell 2012-03-11 23:01:23 -07:00
parent 24158587e6
commit 68db5bf7c1
8 changed files with 26 additions and 26 deletions

22
dist/kinetic-core.js vendored
View File

@ -427,7 +427,7 @@ Kinetic.Node.prototype = {
},
/**
* set zIndex
* @param {int} index
* @param {int} zIndex
*/
setZIndex: function(zIndex) {
var index = this.index;
@ -525,7 +525,7 @@ Kinetic.Node.prototype = {
},
/**
* move node to another container
* @param {Layer} newLayer
* @param {Container} newContainer
*/
moveTo: function(newContainer) {
var parent = this.parent;
@ -643,6 +643,7 @@ Kinetic.Node.prototype = {
handle(this);
}
};
///////////////////////////////////////////////////////////////////////
// Container
///////////////////////////////////////////////////////////////////////
@ -1540,11 +1541,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();
@ -1688,7 +1689,6 @@ Kinetic.GlobalObject.extend(Kinetic.Shape, Kinetic.Node);
*/
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);
@ -1741,6 +1741,7 @@ Kinetic.Rect.prototype = {
// extend Shape
Kinetic.GlobalObject.extend(Kinetic.Rect, Kinetic.Shape);
///////////////////////////////////////////////////////////////////////
// Circle
///////////////////////////////////////////////////////////////////////
@ -1828,7 +1829,7 @@ Kinetic.Image.prototype = {
/**
* get image
*/
getImage: function(image) {
getImage: function() {
return this.image;
},
/**
@ -1869,6 +1870,7 @@ Kinetic.Image.prototype = {
};
// extend Shape
Kinetic.GlobalObject.extend(Kinetic.Image, Kinetic.Shape);
///////////////////////////////////////////////////////////////////////
// Polygon
///////////////////////////////////////////////////////////////////////
@ -2090,7 +2092,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";
@ -2274,3 +2275,4 @@ Kinetic.Text.prototype = {
};
// extend Shape
Kinetic.GlobalObject.extend(Kinetic.Text, Kinetic.Shape);

File diff suppressed because one or more lines are too long

View File

@ -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);
}
};
};

View File

@ -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();

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -2,7 +2,7 @@
<html>
<head>
<link rel="stylesheet" type="text/css"href="base.css">
<script src="../dist/kinetic-core.js"></script>
<script src="../dist/kinetic-v3.8.3.min.js"></script>
<script src="unitTests.js"></script>
<script src="testMethods.js"></script>
<script>