cleaned up Canvas

This commit is contained in:
Eric Rowell
2013-04-12 23:45:22 -07:00
parent ad0ecd9fe9
commit 8138d2d286
4 changed files with 2 additions and 38 deletions

View File

@@ -423,13 +423,4 @@
};
Kinetic.Global.extend(Kinetic.HitCanvas, Kinetic.Canvas2D);
Kinetic.GenericCanvas = function(config) {
Kinetic.Canvas.call(this, config);
};
Kinetic.GenericCanvas.prototype = {
clear: function() {}
};
Kinetic.Global.extend(Kinetic.GenericCanvas, Kinetic.Canvas);
})();

View File

@@ -16,22 +16,12 @@
Kinetic.Layer.prototype = {
_initLayer: function(config) {
var contextType = '';
this.nodeType = 'Layer';
this.createAttrs();
// call super constructor
Kinetic.Container.call(this, config);
contextType = this.getContextType();
if (contextType === '2d') {
this.canvas = new Kinetic.SceneCanvas();
}
else {
this.canvas = new Kinetic.GenericCanvas({
contextType: contextType
});
}
this.canvas = new Kinetic.SceneCanvas();
this.canvas.getElement().style.position = 'absolute';
this.hitCanvas = new Kinetic.HitCanvas();
},
@@ -222,7 +212,6 @@
// add getters and setters
Kinetic.Node.addGetterSetter(Kinetic.Layer, 'clearBeforeDraw', true);
Kinetic.Node.addGetterSetter(Kinetic.Layer, 'contextType', '2d');
/**
* set flag which determines if the layer is cleared or not

View File

@@ -3,6 +3,7 @@
<head>
<link rel="stylesheet" type="text/css"href="../base.css">
<script src="../../dist/kinetic-vcurrent.js"></script>
<!-- assets -->
<script src="../assets/worldMap.js"></script>
<script src="../assets/tiger.js"></script>

View File

@@ -28,24 +28,7 @@ Test.Modules.LAYER = {
test(style.padding === '0px', 'canvas padding style should be 0px');
test(style.backgroundColor === 'transparent', 'canvas backgroundColor style should be transparent');
},
'webgl context type': function(containerId) {
var stage = new Kinetic.Stage({
container: containerId,
width: 578,
height: 200
});
var layer = new Kinetic.Layer({
contextType: 'experimental-webgl'
});
stage.add(layer);
test(layer.getContextType() === 'experimental-webgl', 'context type should be experimental-webgl');
},
'layer getIntersections()': function(containerId) {
var stage = new Kinetic.Stage({
container: containerId,