mirror of
https://github.com/konvajs/konva.git
synced 2025-09-18 09:50:05 +08:00
cleaned up Canvas
This commit is contained in:
@@ -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);
|
||||
})();
|
||||
|
13
src/Layer.js
13
src/Layer.js
@@ -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
|
||||
|
@@ -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>
|
||||
|
@@ -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,
|
||||
|
Reference in New Issue
Block a user