From 8fbcbee28c697433f816e1f10353514833c2f360 Mon Sep 17 00:00:00 2001 From: LV-426 Date: Thu, 13 Nov 2014 17:07:22 +0200 Subject: locate_visual_element() using model object's id --- scripts/rz_core.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/scripts/rz_core.js b/scripts/rz_core.js index e84e9d06..8e4d1a89 100644 --- a/scripts/rz_core.js +++ b/scripts/rz_core.js @@ -119,6 +119,21 @@ var initDrawingArea = function () { initDrawingArea(); +/** + * find the visual element counterpart of a given model object. This relies on + * the visual element having an id attribute equal to the object's id. + * + * @return null if visual element is not found + */ +function locate_visual_element(model_obj){ + var id_sel = $('#' + model_obj.id); + if (0 == id_sel.length){ + console.warn('unable to find visual element for model object: object id: ' + model_obj.id.toString()) + return null; + } + return id_sel[0]; +} + function update(no_relayout) { var node, link, -- cgit v1.3.1