MCPcopy Create free account
hub / github.com/adobe/Marinus / selectObject

Function selectObject

web_server/public/javascripts/cert_graph.js:639–693  ·  view source on GitHub ↗
(obj, el)

Source from the content-addressed store, hash-verified

637}
638
639function selectObject(obj, el) {
640 var node;
641 if (el) {
642 node = d3.select(el);
643 } else {
644 graph.node.each(function (d) {
645 if (d === obj) {
646 node = d3.select(el = this);
647 }
648 });
649 }
650 if (!node) return;
651
652 if (node.classed('selected')) {
653 deselectObject();
654 return;
655 }
656 deselectObject(false);
657
658 selected = {
659 obj: obj,
660 el: el
661 };
662
663 highlightObject(null, obj);
664
665 node.classed('selected', true);
666 $('#docs').html(createDocs(obj));
667 $('#docs-container').scrollTop(0);
668 resize(true);
669
670 var $graph = $('#graph-container'),
671 nodeRect = {
672 left: obj.x + obj.extent.left + graph.margin.left,
673 top: obj.y + obj.extent.top + graph.margin.top,
674 width: obj.extent.right - obj.extent.left,
675 height: obj.extent.bottom - obj.extent.top
676 },
677 graphRect = {
678 left: $graph.scrollLeft(),
679 top: $graph.scrollTop(),
680 width: $graph.width(),
681 height: $graph.height()
682 };
683 if (nodeRect.left < graphRect.left ||
684 nodeRect.top < graphRect.top ||
685 nodeRect.left + nodeRect.width > graphRect.left + graphRect.width ||
686 nodeRect.top + nodeRect.height > graphRect.top + graphRect.height) {
687
688 $graph.animate({
689 scrollLeft: nodeRect.left + nodeRect.width / 2 - graphRect.width / 2,
690 scrollTop: nodeRect.top + nodeRect.height / 2 - graphRect.height / 2
691 }, 500);
692 }
693}
694
695function deselectObject(doResize) {
696 if (doResize || typeof doResize == 'undefined') {

Callers 2

cert_graph.jsFile · 0.70
drawGraphFunction · 0.70

Calls 4

createDocsFunction · 0.85
deselectObjectFunction · 0.70
highlightObjectFunction · 0.70
resizeFunction · 0.70

Tested by

no test coverage detected