<commit_before>define(function(require) {

    'use strict';

    var PIXI = require('pixi');

    var Vector2 = require('common/math/vector2');
    var Colors  = require('common/colors/colors');

    var CircuitInteraction = require('models/circuit-interaction');

    var Draggable = require('views/draggable');

    var Constants = require('constants');

    /**
     * We don't want the hover overlays visible on any object while another object is dragging.
     */
    var someComponentIsDragging = false;

    /**
     * A view that represents a circuit component
     */
    var JunctionView = Draggable.extend({

        contextMenuContent: '<li><a class="split-btn"><span class="fa fa-chain-broken"></span>&nbsp; Split Junction</a></li>',

        /**
         * Overrides Draggable's initializeDisplayObject function
         */
        initializeDisplayObject: function() {
            this.displayObject = new PIXI.Graphics();
        },

        /**
         * Initializes the new JunctionView.
         */
        initialize: function(options) {
            this.color = Colors.parseHex(JunctionView.SOLDER_COLOR);

            // Cached objects
            this._point = new Vector2();

            Draggable.prototype.initialize.apply(this, arguments);

            this.listenTo(this.model, 'change:position', this.updatePosition);
            this.listenTo(this.circuit, 'junctions-collapsed junction-split', this.updateSolder);
            this.listenTo(this.circuit.branches, 'add remove reset', this.updateSolder);
            this.listenTo(this.circuit.junctions, 'add remove reset', this.updateSolder);
            this.listenTo(this.circuit, 'change:schematic', this.schematicModeChanged);
        },

        detach: function() {
            Draggable.prototype.detach.apply(this, arguments);

            if (this.solderLayer.parent)
                this.solderLayer.parent.removeChild(this.solderLayer);
        },

        initGraphics: function() {
            this.displayObject.hitArea = new PIXI.Circle(0, 0, 1);
            this.displayObject.buttonMode = true;
            this.displayObject.defaultCursor = 'move';

            this.schematicGraphics = new PIXI.Graphics();
            this.schematicGraphics.visible = false;
            this.displayObject.addChild(this.schematicGraphics);

            this.solderLayer = new PIXI.Graphics();

            this.hoverGraphics = new PIXI.Graphics();
            this.hoverLayer.addChild(this.hoverGraphics);

            Draggable.prototype.initGraphics.apply(this, arguments);
        },

        updatePosition: function(model, position) {
            var viewPosition = this.mvt.modelToView(position);
            var viewX = viewPosition.x;
            var viewY = viewPosition.y;

            this.solderLayer.x = viewX;
            this.solderLayer.y = viewY;

            this.displayObject.x = viewX;
            this.displayObject.y = viewY;
            this.displayObject.hitArea.radius = this.getRadius();

            this.hoverGraphics.x = viewX;
            this.hoverGraphics.y = viewY;
        },

        draw: function() {
            var radius = this.getRadius();
            var solderRadius = this.getSolderRadius();

            var solderGraphics = this.solderLayer;
            solderGraphics.clear();
            solderGraphics.beginFill(this.color, 1);
            solderGraphics.drawCircle(0, 0, solderRadius);
            solderGraphics.endFill();

            var schematicGraphics = this.schematicGraphics;
            schematicGraphics.clear();
            schematicGraphics.beginFill();
            schematicGraphics.drawCircle(0, 0, radius * 0.5);
            schematicGraphics.endFill();

            var hoverGraphics = this.hoverGraphics;
            hoverGraphics.clear();
            hoverGraphics.beginFill(this.selectionColor, 1);
            hoverGraphics.drawCircle(0, 0, radius);
            hoverGraphics.endFill();
            hoverGraphics.beginFill(this.selectionColor, Constants.SELECTION_AURA_ALPHA);
            hoverGraphics.drawCircle(0, 0, radius * 2);
            hoverGraphics.endFill();
        },

        updateMVT: function(mvt) {
            Draggable.prototype.updateMVT.apply(this, arguments);

            this.draw();
            this.updatePosition(this.model, this.model.get('position'));
            this.updateSolder();
        },

        updateSolder: function(j1, j2, replacement) {
            if (this.isConnected())
                this.solderLayer.visible = true;
            else
                this.solderLayer.visible = false;
        },

        getRadius: function() {
            return Math.round(this.mvt.modelToViewDeltaX(JunctionView.RADIUS));
        },

        getSolderRadius: function() {
            return Math.round(this.mvt.modelToViewDeltaX(JunctionView.SOLDER_RADIUS));
        },

        _drag: function(event) {<commit_msg>Fixed the solder and schematic mode graphics not showing or showing when they shouldn't.<commit_after>define(function(require) {

    'use strict';

    var PIXI = require('pixi');

    var Vector2 = require('common/math/vector2');
    var Colors  = require('common/colors/colors');

    var CircuitInteraction = require('models/circuit-interaction');

    var Draggable = require('views/draggable');

    var Constants = require('constants');

    /**
     * We don't want the hover overlays visible on any object while another object is dragging.
     */
    var someComponentIsDragging = false;

    /**
     * A view that represents a circuit component
     */
    var JunctionView = Draggable.extend({

        contextMenuContent: '<li><a class="split-btn"><span class="fa fa-chain-broken"></span>&nbsp; Split Junction</a></li>',

        /**
         * Overrides Draggable's initializeDisplayObject function
         */
        initializeDisplayObject: function() {
            this.displayObject = new PIXI.Graphics();
        },

        /**
         * Initializes the new JunctionView.
         */
        initialize: function(options) {
            this.color = Colors.parseHex(JunctionView.SOLDER_COLOR);

            // Cached objects
            this._point = new Vector2();

            Draggable.prototype.initialize.apply(this, arguments);

            this.listenTo(this.model, 'change:position', this.updatePosition);
            this.listenTo(this.circuit, 'junctions-collapsed junction-split', this.updateSolder);
            this.listenTo(this.circuit.branches, 'add remove reset', this.updateSolder);
            this.listenTo(this.circuit.junctions, 'add remove reset', this.updateSolder);
            this.listenTo(this.circuit, 'change:schematic', this.schematicModeChanged);
        },

        detach: function() {
            Draggable.prototype.detach.apply(this, arguments);

            if (this.solderLayer.parent)
                this.solderLayer.parent.removeChild(this.solderLayer);
        },

        initGraphics: function() {
            this.displayObject.hitArea = new PIXI.Circle(0, 0, 1);
            this.displayObject.buttonMode = true;
            this.displayObject.defaultCursor = 'move';

            this.schematicGraphics = new PIXI.Graphics();
            this.schematicGraphics.visible = false;
            this.displayObject.addChild(this.schematicGraphics);

            this.solderLayer = new PIXI.Graphics();

            this.hoverGraphics = new PIXI.Graphics();
            this.hoverLayer.addChild(this.hoverGraphics);

            this.schematicModeChanged(this.circuit, this.circuit.get('schematic'));

            Draggable.prototype.initGraphics.apply(this, arguments);
        },

        updatePosition: function(model, position) {
            var viewPosition = this.mvt.modelToView(position);
            var viewX = viewPosition.x;
            var viewY = viewPosition.y;

            this.solderLayer.x = viewX;
            this.solderLayer.y = viewY;

            this.displayObject.x = viewX;
            this.displayObject.y = viewY;
            this.displayObject.hitArea.radius = this.getRadius();

            this.hoverGraphics.x = viewX;
            this.hoverGraphics.y = viewY;
        },

        draw: function() {
            var radius = this.getRadius();
            var solderRadius = this.getSolderRadius();

            var solderGraphics = this.solderLayer;
            solderGraphics.clear();
            solderGraphics.beginFill(this.color, 1);
            solderGraphics.drawCircle(0, 0, solderRadius);
            solderGraphics.endFill();

            var schematicGraphics = this.schematicGraphics;
            schematicGraphics.clear();
            schematicGraphics.beginFill();
            schematicGraphics.drawCircle(0, 0, radius * 0.5);
            schematicGraphics.endFill();

            var hoverGraphics = this.hoverGraphics;
            hoverGraphics.clear();
            hoverGraphics.beginFill(this.selectionColor, 1);
            hoverGraphics.drawCircle(0, 0, radius);
            hoverGraphics.endFill();
            hoverGraphics.beginFill(this.selectionColor, Constants.SELECTION_AURA_ALPHA);
            hoverGraphics.drawCircle(0, 0, radius * 2);
            hoverGraphics.endFill();
        },

        updateMVT: function(mvt) {
            Draggable.prototype.updateMVT.apply(this, arguments);

            this.draw();
            this.updatePosition(this.model, this.model.get('position'));
            this.updateSolder();
        },

        updateSolder: function(j1, j2, replacement) {
            if (this.isConnected() && !this.circuit.get('schematic'))
                this.solderLayer.visible = true;
            else
                this.solderLayer.visible = false;
        },

        getRadius: function() {
            return Math.round(this.mvt.modelToViewDeltaX(JunctionView.RADIUS));
        },

        getSolderRadius: function() {
            return Math.round(this.mvt.modelToViewDeltaX(JunctionView.SOLDER_RADIUS));
        },

        _drag: function(event) {
{'fraction_non_alphanumeric': 0.11098901098901098, 'fraction_numerical': 0.004195804195804196, 'mean_word_length': 2.1821360457724093, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2267715', 'n_tokens_mistral': 2793, 'n_tokens_neox': 2649, 'n_words': 482}