Skip to content

Commit

Permalink
Basic function to redraw a relation in a draw context. This has not b…
Browse files Browse the repository at this point in the history
…een integrated with the undo mechanics yet.
  • Loading branch information
Petter Ericson committed Jul 29, 2021
1 parent 43378da commit 694560c
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions js/draw.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,20 @@ function draw_relation(draw_context, mei_graph, g_elem) {

}

function redraw_relation(draw_context,g_elem) {
var svg_g_elem = get_by_id(document, id_in_svg(draw_context, get_id(g_elem)));
if(!svg_g_elem){
console.log("Unable to redraw relation: ",g_elem," in draw context ", draw_context);
return;
}
unmark_secondaries(draw_context,mei_graph,g_elem);
svg_g_elem.parentElement.removeChild(svg_g_elem);
svg_g_elem = draw_relation(draw_context, mei_graph, g_elem);
mark_secondaries(draw_context,mei_graph,g_elem);
return svg_g_elem[0];
}



// Essentially the same procedure as above, but for metarelations
function draw_metarelation(draw_context, mei_graph, g_elem) {
Expand Down

0 comments on commit 694560c

Please sign in to comment.