How do I store what I have selected in canvas and fabric

0

Well that's a figure and if I select it it is painted red and if I want to mark many more and then save it to a mysql database. please help I have to do it with JSON

var fig_a1 = new fabric.Path('M 78 72 L 40 45 C 39 22 160 21 162 44 L 123 72 C 125 64 81 60 78 72 Z');
    fig_a1.set({scaleX:nEscala , scaleY:nEscala, fill: 'rgb(237, 247, 250)' });
    canvas.add(fig_a1);

elegido_a1 = false;
fig_a1.on('mousedown',function(e){ 
    if (elegido_a1 == false){ 
        fig_a1.set({fill: 'rgb(240,0,0)'});
        elegido_a1 = true;
    }else{
        fig_a1.set({fill: 'rgb(200,200,200)'});
        elegido_a1 = false;
    }; 
});

Attempt ..:

[![var texto = {
    "fig_a1":1,
    "fig_a2":2,
    "fig_a3":3,
    "fig_a4":4,
    "fig_a5":5
};

var tjson = JSON.stringify(texto);
window.location="demo_json.php?x=" + tjson;][1]][1]
    
asked by Jostin Joseph 16.03.2018 в 20:16
source

0 answers