plugin/plugin copy.js
// Highlights node and all of its predecessors
Highlights node and all of its predecessors
Highlights node and all of its predecessors
function highlight(d) {
        d3.select(this).style('opacity', 0.9);
        node.style("stroke", function(o) {
            if(d.type == "goal") {
                if(graph.get('goal').preconditions.includes(o.id) || d.id == o.id) {
                    return '#a7440f';
                } else {
                    return 'none';
                }
            } else if(d.type == "action") {
                if(actions.get(d.id).get('preconditions').includes(o.id) || d.id == o.id) {
                    return '#a7440f';
                } else {
                    return 'none';
                }
            } else {
                if(fluentPreconditions[d.id].includes(o.id) || d.id == o.id) {
                    return '#a7440f';
                } else {
                    return 'none';
                }
            }
        });
        node.style("opacity", function(o) {
            if(d.type == "goal") {
                if(graph.get('goal').preconditions.includes(o.id) || d.id == o.id) {
                    return 1;
                } else {
                    return 0.5;
                }
            } else if(d.type == "action") {
                if(actions.get(d.id).get('preconditions').includes(o.id) || d.id == o.id) {
                    return 1;
                } else {
                    return 0.5;
                }
            } else {
                if(fluentPreconditions[d.id].includes(o.id) || d.id == o.id) {
                    return 1;
                } else {
                    return 0.5;
                }
            }
        });
        text.style('opacity', function(o) {
            if(d.type == "goal") {
                if(graph.get('goal').preconditions.includes(o.id) || d.id == o.id) {
                    return 1;
                } else {
                    return 0.5;
                }
            } else if(d.type == "action") {
                if(actions.get(d.id).get('preconditions').includes(o.id) || d.id == o.id) {
                    return 1;
                } else {
                    return 0.5;
                }
            } else {
                if(fluentPreconditions[d.id].includes(o.id) || d.id == o.id) {
                    return 1;
                } else {
                    return 0.5;
                }
            }
        });
        link
            .style('stroke', function (o) {
                if(o.target.id == d.id) {
                    return '#69b3b2';
                } else {
                    return '#b8b8b8';
                }
            })
            .style('opacity', function(o) {
                if(o.target.id == d.id) {
                    return 1;
                } else {
                    return 0.5;
                }
            });
    }
function highlight ( d ) { d3 . select ( this ) . style ( 'opacity' , 0.9 ) ; node . style ( "stroke" , function ( o ) { if ( d . type == "goal" ) { if ( graph . get ( 'goal' ) . preconditions . includes ( o . id ) || d . id == o . id ) { return '#a7440f' ; } else { return 'none' ; } } else if ( d . type == "action" ) { if ( actions . get ( d . id ) . get ( 'preconditions' ) . includes ( o . id ) || d . id == o . id ) { return '#a7440f' ; } else { return 'none' ; } } else { if ( fluentPreconditions [ d . id ] . includes ( o . id ) || d . id == o . id ) { return '#a7440f' ; } else { return 'none' ; } } } ) ; node . style ( "opacity" , function ( o ) { if ( d . type == "goal" ) { if ( graph . get ( 'goal' ) . preconditions . includes ( o . id ) || d . id == o . id ) { return 1 ; } else { return 0.5 ; } } else if ( d . type == "action" ) { if ( actions . get ( d . id ) . get ( 'preconditions' ) . includes ( o . id ) || d . id == o . id ) { return 1 ; } else { return 0.5 ; } } else { if ( fluentPreconditions [ d . id ] . includes ( o . id ) || d . id == o . id ) { return 1 ; } else { return 0.5 ; } } } ) ; text . style ( 'opacity' , function ( o ) { if ( d . type == "goal" ) { if ( graph . get ( 'goal' ) . preconditions . includes ( o . id ) || d . id == o . id ) { return 1 ; } else { return 0.5 ; } } else if ( d . type == "action" ) { if ( actions . get ( d . id ) . get ( 'preconditions' ) . includes ( o . id ) || d . id == o . id ) { return 1 ; } else { return 0.5 ; } } else { if ( fluentPreconditions [ d . id ] . includes ( o . id ) || d . id == o . id ) { return 1 ; } else { return 0.5 ; } } } ) ; link . style ( 'stroke' , function ( o ) { if ( o . target . id == d . id ) { return '#69b3b2' ; } else { return '#b8b8b8' ; } } ) . style ( 'opacity' , function ( o ) { if ( o . target . id == d . id ) { return 1 ; } else { return 0.5 ; } } ) ; }
Highlights node and all of its predecessors
Highlights node and all of its predecessors
// d is this // o is other // o is precondition // o is precondition // o is precondition // o is precondition // o is precondition // o is precondition // o is precondition // o is precondition // o is precondition