Commit aa2528f0 authored by Pedro Eduardo Trujillo's avatar Pedro Eduardo Trujillo
Browse files

Revisa svg de tracking por fallos en chrome

En versiones recientes de Chrome, ha dejado de funcionar correctamente
el resaltado de la línea de tracking cuando el cursor pasa por encima.
Se han añadido comprobaciones y eliminado posibles causas de bucles
infinitos en la lógica de manejo de nodos y clases CSS.
parent 691d45c5
Loading
Loading
Loading
Loading
+17 −9
Original line number Diff line number Diff line
@@ -153,20 +153,24 @@ define([

		_createEventListeners: function() {

			this._onEnterCallback && this._onEnterCallback.remove();
			this._onLeaveCallback && this._onLeaveCallback.remove();
			this._onEnterCallback?.remove();
			this._onLeaveCallback?.remove();

			var svgNode = this._svg.node();
			const svgNode = this._svg.node();

			this._onEnterCallback = on(svgNode, mouse.enter, lang.hitch(this, this._addHoverEffects));
			this._onLeaveCallback = on(svgNode, mouse.leave, lang.hitch(this, this._removeHoverEffects));
			this._onLeaveCallback = on(svgNode, mouse.leave, () => this._removeHoverEffects());
			this._onEnterCallback = on(svgNode, mouse.enter, () => this._addHoverEffects());
		},

		_addHoverEffects: function() {

			var svgNode = this._svg.node(),
				svgParentNode = svgNode && svgNode.parentNode;
			const svgNode = this._svg.node();

			if (!svgNode || this._svg.attr('class').includes(this.svgHoverClass)) {
				return;
			}

			const svgParentNode = svgNode.parentNode;
			svgParentNode && domClass.add(svgParentNode, this._childHoverClass);

			this._svg
@@ -176,9 +180,13 @@ define([

		_removeHoverEffects: function() {

			var svgNode = this._svg.node(),
				svgParentNode = svgNode && svgNode.parentNode;
			const svgNode = this._svg.node();

			if (!svgNode || !this._svg.attr('class').includes(this.svgHoverClass)) {
				return;
			}

			const svgParentNode = svgNode.parentNode;
			svgParentNode && domClass.remove(svgParentNode, this._childHoverClass);

			this._svg.attr('class', this.svgClass);
+14 −8
Original line number Diff line number Diff line
@@ -153,24 +153,30 @@ define([

		_createEventListeners: function() {

			this._onEnterCallback && this._onEnterCallback.remove();
			this._onLeaveCallback && this._onLeaveCallback.remove();
			this._onEnterCallback?.remove();
			this._onLeaveCallback?.remove();

			var gNode = this._group.node();
			const gNode = this._group.node();

			this._onEnterCallback = on(gNode, mouse.enter, lang.hitch(this, this._addHoverEffects));
			this._onLeaveCallback = on(gNode, mouse.leave, lang.hitch(this, this._removeHoverEffects));
			this._onLeaveCallback = on(gNode, mouse.leave, () => this._removeHoverEffects());
			this._onEnterCallback = on(gNode, mouse.enter, () => this._addHoverEffects());
		},

		_addHoverEffects: function() {

			this._group
				.attr('class', this.groupClass + ' ' + this.groupHoverClass)
				.moveToFront();
			if (this._group.attr('class').includes(this.groupHoverClass)) {
				return;
			}

			this._group.attr('class', this.groupClass + ' ' + this.groupHoverClass);
		},

		_removeHoverEffects: function() {

			if (!this._group.attr('class').includes(this.groupHoverClass)) {
				return;
			}

			this._group.attr('class', this.groupClass);
		},