diff --git a/react-demos/custom_shape/src/index.js b/react-demos/custom_shape/src/index.js index 2bcdbccbd..8232289e5 100755 --- a/react-demos/custom_shape/src/index.js +++ b/react-demos/custom_shape/src/index.js @@ -9,12 +9,17 @@ class App extends Component { { + width={260} + height={170} + sceneFunc={function (context, shape) { + const width = shape.width(); + const height = shape.height(); context.beginPath(); - context.moveTo(20, 50); - context.lineTo(220, 80); - context.quadraticCurveTo(150, 100, 260, 170); + context.moveTo(0, 0); + context.lineTo(width - 40, height - 90); + context.quadraticCurveTo(width - 110, height - 70, width, height); context.closePath(); + // (!) Konva specific method, it is very important context.fillStrokeShape(shape); }} diff --git a/source/downloads/code/shapes/Custom.html b/source/downloads/code/shapes/Custom.html index e2d4c70d4..704a574d0 100644 --- a/source/downloads/code/shapes/Custom.html +++ b/source/downloads/code/shapes/Custom.html @@ -30,11 +30,15 @@ * drawing function which draws a triangle */ var triangle = new Konva.Shape({ + width: 260, + height: 170, sceneFunc: function (context, shape) { + const width = shape.width(); + const height = shape.height(); context.beginPath(); - context.moveTo(20, 50); - context.lineTo(220, 80); - context.quadraticCurveTo(150, 100, 260, 170); + context.moveTo(0, 0); + context.lineTo(width - 40, height - 90); + context.quadraticCurveTo(width - 110, height - 70, width, height); context.closePath(); // (!) Konva specific method, it is very important diff --git a/svelte-demos/custom_shape/src/App.svelte b/svelte-demos/custom_shape/src/App.svelte index ef85b8742..23a5c69a4 100644 --- a/svelte-demos/custom_shape/src/App.svelte +++ b/svelte-demos/custom_shape/src/App.svelte @@ -6,14 +6,18 @@