mirror of
https://github.com/konvajs/konva.git
synced 2025-11-18 17:17:49 +08:00
first round of new Path shape. Despite multiple optimizations, the path performance isn't as good as a previous experiment done with v3.8.1. Will keep this as a separate branch until the performance issues are resolved
This commit is contained in:
177
tests/assets/worldMap.js
Normal file
177
tests/assets/worldMap.js
Normal file
File diff suppressed because one or more lines are too long
@@ -3,6 +3,7 @@
|
||||
<head>
|
||||
<link rel="stylesheet" type="text/css"href="../base.css">
|
||||
<script src="../../dist/kinetic-core.js"></script>
|
||||
<script src="../assets/worldMap.js"></script>
|
||||
<script src="../js/Test.js"></script>
|
||||
<script src="../js/unitTests.js"></script>
|
||||
<script>
|
||||
|
||||
@@ -16,7 +16,7 @@ function log(message) {
|
||||
* Test constructor
|
||||
*/
|
||||
function Test() {
|
||||
this.testOnly = '';
|
||||
this.testOnly = 'SHAPE - add path';
|
||||
this.counter = 0;
|
||||
|
||||
testCounter = document.createElement('div');
|
||||
|
||||
@@ -1169,6 +1169,44 @@ Test.prototype.tests = {
|
||||
});
|
||||
//stage.start();
|
||||
},
|
||||
'SHAPE - add path': function(containerId) {
|
||||
var stage = new Kinetic.Stage({
|
||||
container: containerId,
|
||||
width: 1024,
|
||||
height: 480
|
||||
});
|
||||
var layer = new Kinetic.Layer();
|
||||
|
||||
for(var key in worldMap) {
|
||||
var c = worldMap[key];
|
||||
// induce scope
|
||||
( function() {
|
||||
var path = new Kinetic.Path({
|
||||
commands: c,
|
||||
fill: '#ccc',
|
||||
stroke: '#999',
|
||||
strokeWidth: 1
|
||||
});
|
||||
|
||||
path.on('mouseover', function() {
|
||||
//console.log(1)
|
||||
//path.setFill('red');
|
||||
//layer.draw();
|
||||
});
|
||||
|
||||
path.on('mouseout', function() {
|
||||
//path.setFill('#ccc');
|
||||
//layer.draw();
|
||||
});
|
||||
|
||||
layer.add(path);
|
||||
|
||||
}());
|
||||
|
||||
stage.add(layer);
|
||||
}
|
||||
|
||||
},
|
||||
'SHAPE - add shape with custom attr pointing to self': function(containerId) {
|
||||
var stage = new Kinetic.Stage({
|
||||
container: containerId,
|
||||
|
||||
Reference in New Issue
Block a user