javascript - using fabricjs to get selected group on canvas and then change text -
i trying add curved text on canvas . example works al right . trying add curved text whenever user type text in text-area should check if 1 canvas object selected if selected text selected object should change otherwise new object should added on canvas .
check fiddle , http://jsfiddle.net/nhs8t/7/
below code have written check if object on canvas selected or not ?? canvas.getactivegroup() not working ???
jquery code::
$('.text').change(function() { var act = canvas.getactivegroup(); var obj = canvas.getactiveobject(); if(!obj) { console.log('object not selected'); }else { console.log('object selected'); } if (!canvas.getactivegroup()) { console.log('if part executed--object not selected'); curvedtext[cur] = new curvedtext(canvas, {}); curvedtext[cur].center(); curvedtext[cur].settext($(this).val()); cur++; } else { console.log('else part executed-object selected'); act.settext($(this).val()); $("<li id='item_li" + + "' class='item_list'> " + $(this).val() + " <div class='updown' style='text-align:right;'> [ <a id='down_link" + + "' class='down'>down</a> ] [<a id='close_link" + + "' class='close'>close</a>] </div></li>").appendto($("#items_list")); } });
Comments
Post a Comment