diff --git a/src/Canvas.js b/src/Canvas.js index 37517f1b..2a7bfe68 100644 --- a/src/Canvas.js +++ b/src/Canvas.js @@ -38,6 +38,13 @@ this.element.style.background = 'transparent'; this.context = this.element.getContext(contextType); this.setSize(width, height); + + this.element.addEventListener('mousedown', function(evt) { + evt.preventDefault(); + }); + this.element.addEventListener('touchstart', function(evt) { + evt.preventDefault(); + }); }, /** * get canvas element diff --git a/tests/html/unitTests.html b/tests/html/unitTests.html index 51de7a7c..edcc82ab 100644 --- a/tests/html/unitTests.html +++ b/tests/html/unitTests.html @@ -22,5 +22,5 @@ }; - + diff --git a/tests/js/unit/shapes/rectTests.js b/tests/js/unit/shapes/rectTests.js index ae5d01c5..04bd76c1 100644 --- a/tests/js/unit/shapes/rectTests.js +++ b/tests/js/unit/shapes/rectTests.js @@ -27,6 +27,26 @@ Test.Modules.RECT = { test(rect.getClassName() === 'Rect', 'className should be Rect'); }, + 'add fill stroke rect': function(containerId) { + var stage = new Kinetic.Stage({ + container: containerId, + width: 578, + height: 200 + }); + var layer = new Kinetic.Layer(); + var rect = new Kinetic.Rect({ + x: 200, + y: 100, + width: 100, + height: 50, + fill: 'blue', + stroke: 'green', + strokeWidth: 4 + }); + + layer.add(rect); + stage.add(layer); + }, 'add stroke rect': function(containerId) { var stage = new Kinetic.Stage({ container: containerId,