Note that there are some explanatory texts on larger screens.

plurals
  1. POClick anywhere and type text, and then edit it, by clicking on it
    primarykey
    data
    text
    <p>I'm working with kineticJS framework, and i want to make tool, which lets you click anywhere and type text, and if you click on already existing text, it will let you edit that text realtime. (same functionality like in word, as TextBox). Also i'll need to make that text subscript/superscript and etc. in future. I have no idea, how to make text editable realtime using keyboard. I know there is Text element in kineticjs, but that doesn't help me, because as far as i know you can't edit it in realtime (when clicking keyboard buttons). Also this should work on tablet devices. Any help would be greatly appreciated.</p> <p>Long story short:</p> <ul> <li>Using: <ul> <li>KineticJS(Canvas) </li> </ul></li> <li>Need: <ul> <li>Clicking anywhere places marker, which adds letters when i'm typing using keyboard, or tablet keyboard.</li> <li>Clicking on already existing text, will place marker there and let me edit that text.</li> <li>In future, i should have ability to set these features to that text: <ul> <li>set color</li> <li>change font</li> <li>add subscript/superscript</li> <li>bold/underline/italic</li> </ul></li> </ul></li> </ul> <p>Work in progress can be found here: <a href="http://jsfiddle.net/66UcL/1/" rel="nofollow">http://jsfiddle.net/66UcL/1/</a></p> <p>CodeJS:</p> <pre><code>console.clear(); var containerID = "kiCanvas"; var stage = new Kinetic.Stage({ container: containerID, width: 600, height: 500, }); var layer = new Kinetic.Layer(); stage.add(layer); $('#drawText').on('click', function () { $('canvas').on('click', drawText); }); function drawText(e) { var newText = new Kinetic.Text({ text: "Text", x: e.clientX, y: e.clientY, fill: 'red', }); layer.add(newText); layer.draw(); } </code></pre> <p>CodeHTML:</p> <pre><code>&lt;button id="drawText"&gt;AddTextToCanvas&lt;/button&gt; &lt;div id="kiCanvas" /&gt; </code></pre> <p>TODO:</p> <ul> <li>Add cursor where you click, not full text.</li> <li>Let you edit text, when you click on it.</li> </ul> <p>EDIT:</p> <p>I've found a way, with input, which has 0 opacity, and which has event onKeyUp, updates text object in canvas, i'll upload sample, when it will be ready for public.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload