mirror of
https://github.com/konvajs/konva.git
synced 2025-06-28 02:21:20 +08:00
minor code cleanup discovered by Wappworks
This commit is contained in:
parent
24158587e6
commit
68db5bf7c1
22
dist/kinetic-core.js
vendored
22
dist/kinetic-core.js
vendored
@ -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);
|
||||
|
||||
|
2
dist/kinetic-core.min.js
vendored
2
dist/kinetic-core.min.js
vendored
File diff suppressed because one or more lines are too long
@ -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);
|
||||
|
@ -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>
|
||||
|
Loading…
Reference in New Issue
Block a user