powsybl / powsybl-dev-tools

2 stars 1 forks source link

Add callback to operate switches #28

Closed flo-dup closed 2 years ago

flo-dup commented 2 years ago
// select elements
var elements = Array.from(document.querySelectorAll('svg .sld-breaker'));

// add event listeners
elements.forEach(function(el) {
   el.addEventListener("click",  open);
// other event listener have to be added to allow the breaker to be moved - but not so useful I'd say
})

// event listener functions
function open(e){
  // change sld-closed by sld-open (or the opposite) for the element clicked on
  // calling java method to recompute the SVG diagram
}

Various links: