Projekt

Obecné

Profil

« Předchozí | Další » 

Revize 4ca53f47

Přidáno uživatelem Pavel Fidranský před více než 6 roky(ů)

detached stopPropagation function to Utils

Zobrazit rozdíly:

sources/src/main/webapp/js/components/edgePopover.js
67 67
		rootElement = app.utils.createHtmlElement('div', {
68 68
			'class': 'popover edge-popover hidden',
69 69
		});
70
		rootElement.addEventListener('wheel', stopPropagation.bind(this));
71
		rootElement.addEventListener('mousedown', stopPropagation.bind(this));
70
		rootElement.addEventListener('wheel', app.utils.stopPropagation);
71
		rootElement.addEventListener('mousedown', app.utils.stopPropagation);
72 72
		rootElement.addEventListener('mouseleave', this.close.bind(this));
73 73

  
74 74
		var popoverTitle = app.utils.createHtmlElement('span', {
......
88 88
		return rootElement;
89 89
	};
90 90

  
91
	/**
92
	 * Stops propagation of the event which triggered this function to its parental elements.
93
	 * @param {Event} e The event.
94
	 */
95
	function stopPropagation(e) {
96
		e.stopPropagation();
97
	}
98

  
99 91
}
sources/src/main/webapp/js/components/vertex.js
424 424
			'data-name': this.name,
425 425
		});
426 426
		rootElement.addEventListener('click', click.bind(this));
427
		rootElement.addEventListener('dblclick', app.utils.stopPropagation);
427 428
		rootElement.addEventListener('contextmenu', contextMenu.bind(this));
428 429
		rootElement.addEventListener('mousedown', mouseDown.bind(this));
429 430
		
sources/src/main/webapp/js/components/vertexContextMenuList.js
80 80
		rootElement = app.utils.createHtmlElement('div', {
81 81
			'class': 'context-menu hidden',
82 82
		});
83
		rootElement.addEventListener('mousedown', stopPropagation.bind(this));
83
		rootElement.addEventListener('mousedown', app.utils.stopPropagation);
84 84

  
85 85
		listElement = app.utils.createHtmlElement('ul', {});
86 86
		rootElement.appendChild(listElement);
......
88 88
		return rootElement;
89 89
	};
90 90

  
91
	/**
92
	 * Stops propagation of the event which triggered this function to its parental elements.
93
	 * @param {Event} e The event.
94
	 */
95
	function stopPropagation(e) {
96
		e.stopPropagation();
97
	}
98

  
99 91
	/**
100 92
	 * Context menu item click interaction. The vertex this context menu is bound to is either added to the group or merged 
101 93
	 * with the vertex to created a new group.
sources/src/main/webapp/js/components/vertexPopover.js
59 59
		rootElement = app.utils.createHtmlElement('div', {
60 60
			'class': 'popover vertex-popover hidden',
61 61
		});
62
		rootElement.addEventListener('wheel', stopPropagation.bind(this));
63
		rootElement.addEventListener('mousedown', stopPropagation.bind(this));
62
		rootElement.addEventListener('wheel', app.utils.stopPropagation);
63
		rootElement.addEventListener('mousedown', app.utils.stopPropagation);
64 64
		rootElement.addEventListener('mouseleave', this.close.bind(this));
65 65

  
66 66
		popoverTitle = app.utils.createHtmlElement('span', {
......
78 78

  
79 79
		return rootElement;
80 80
	};
81

  
82
	/**
83
	 * Stops propagation of the event which triggered this function to its parental elements.
84
	 * @param {Event} e The event.
85
	 */
86
	function stopPropagation(e) {
87
		e.stopPropagation();
88
	}
89 81
}
sources/src/main/webapp/js/utils/utils.js
8 8
	 */
9 9
	this.noop = function() {};
10 10

  
11
	/**
12
	 * Stops propagation of the mouse interaction to parental elements.
13
	 * @param {MouseEvent} e Click/double-click event.
14
	 */
15
	this.stopPropagation = function(e) {
16
		e.stopPropagation();
17
	};
18

  
11 19
	/**
12 20
	 * Checks whether the variable passed as parameter is defined.
13 21
	 * 

Také k dispozici: Unified diff