PageSourceSearch

https://quaibranly.fr/typo3conf/ext/mqb_base/Resources/Public/Mont…/plan/_components/floor-icons.js?1776327123

js quaibranly.fr collected 2026-10-02 02:55:50 UTC 6,148 bytes, 226 lines download raw bytes

1var APP = APP || {};
2
3(function()
4{
5	"use strict";
6
7	APP.FloorIcons = APP.Abstract.extend(
8	{
9		defaults : {
10			navBottomIcons : null
11		},
12
13		init : function(options,$container,$contentFloors)
14		{
15			var that = this;
16
17			this.EVENT = {
18			};
19
20			this._super(options);
21			this.$.container 		= $container;
22			this.$.contentFloors 	= $contentFloors;
23
24			this.initIcons();
25		},
26
27		/* ------------------------------------------------- */
28		/* ---  public remove */
29		/* ------------------------------------------------- */
30		remove : function()
31		{
32			this._super();
33		},
34
35		/* ------------------------------------------------- */
36		/* ---  public show */
37		/* ------------------------------------------------- */
38		show : function($el,view)
39		{
40			var that 	= this,
41				$view 	= $el.find("div.view."+view);
42
43			this.resize($view,view,false);
44
45			//if (this.floorZoom !== null)
46			//	this.floorZoom.resize();
47
48			$el.find("div.icon").each(function()
49			{
50				var $icon = $(this);
51
52				if ($icon.hasClass("hidden") && that.s.navBottomIcons.isActive($icon.data("type")))
53				{
54					$icon.removeClass("hidden");
55					TweenLite.fromTo($icon, 0.2, {opacity:0,y:-30},{opacity:1,y:0,clearProps:"opacity",ease:Quad.easeOut});
56				}
57				else if (!$icon.hasClass("hidden") && !that.s.navBottomIcons.isActive($icon.data("type")))
58				{
59					TweenLite.to($icon, 0.2, {opacity:0,y:-30,clearProps:"opacity",ease:Quad.easeOut,onComplete:
60						function()
61						{
62							$icon.addClass("hidden");
63						}
64					});
65				}
66			});
67		},
68
69		/* ------------------------------------------------- */
70		/* ---  public hide */
71		/* ------------------------------------------------- */
72		hide : function($el)
73		{
74			$el.find("div.icon").addClass("hidden");
75		},
76
77		/* ------------------------------------------------- */
78		/* ---  public resize */
79		/* ------------------------------------------------- */
80		resize : function($el,view,animate)
81		{
82			var that 				= this,
83				lineHeightArtWork 	= 70,
84				$img 				= $el.find("> img");
85
86			if (!$img.length) return;
87
88			var w 		= $img.width(),
89				h 		= $img.height(),
90				mLeft	= $img.position().left,
91				mTop 	= $img.position().top;
92
93			$el.closest("div.floor").find("> div.icon").each(function()
94			{
95				var $icon 	= $(this),
96					l 		= $icon.data("left"+view),
97					t 		= $icon.data("top"+view),
98					l2 		= Math.floor((l*w)/100 + mLeft - $icon.width()/2),
99					t2;
100
101				if ($icon.hasClass("programmation"))
102				{
103					if ($icon.find("div.ctn").length==2 && !$icon.hasClass("two"))
104						$icon.addClass("two");
105
106					if ($icon.find("div.ctn").length==3 && !$icon.hasClass("three"))
107						$icon.addClass("three");
108				}
109
110				t2 = Math.floor((t*h)/100 + mTop - $icon.height());
111				console.log($icon.attr('class'), l2, t2);
112
113				if (!animate)
114					$icon.css({left:l2+"px",top:t2+"px"});
115				else
116					TweenLite.to($icon, 0.25, {left:l2+"px",top:t2+"px",ease:Quad.easeOut});
117			});
118		},
119
120		/* ------------------------------------------------- */
121		/* ---  public resizeVersionZoom */
122		/* ------------------------------------------------- */
123		resizeVersionZoom : function($container,view)
124		{
125			var that 			= this,
126				lineHeight 		= 70,
127				$img 			= $container.find("> img"),
128				w 				= $img.width(),
129				h 				= $img.height();
130
131			$container.find("div.icon").each(function()
132			{
133				var $icon 		= $(this),
134					l 			= $icon.data("left"+view),
135					t 			= $icon.data("top"+view),
136					l2 			= Math.floor((l*w)/100 - $icon.width()/2),
137					t2 			= Math.floor((t*h)/100 - $icon.height());
138
139				// It would be better to use outerWidth and outerHeight to calculate left and top positions here and in resize function.
140				// By not taking into account paddings, there is a shift in programmation pins position when we use zoom.
141				// If we use outerWith and outerHeight, we will have to check every contributed pins and modify at least all programmation pins coordinates.
142				// This correction allows to correct the problem only for programmation pins when we zoom without contribution.
143				if ($icon.hasClass('programmation')) {
144					l2 = Math.floor((l*w)/100 - ($icon.width() - ($icon.outerWidth() - $icon.width()))/2);
145					t2 = Math.floor((t*h)/100 - ($icon.height() - ($icon.outerHeight() - $icon.height())));
146				}
147
148				$icon.css({left:l2+"px",top:t2+"px"});
149			});
150		},
151
152		/* ------------------------------------------------- */
153		/* ---  initIcons */
154		/* ------------------------------------------------- */
155		initIcons : function()
156		{
157			var that = this,
158				$legend = this.$.contentFloors.find("span.icon-label-roll");
159
160			this.$.contentFloors.on(CONF.s.clickEvent +" mouseenter mouseleave","div.icon",function(event)
161			{
162				var $el = $(this),
163					l,t,margin = 20;
164
165				if (event.type == CONF.s.clickEvent)
166				{
167					$el.find("a").trigger(CONF.s.clickEvent);
168				}
169				else if (event.type == "mouseenter" && $el.hasClass('pin'))
170				{
171					l = $el.offset().left;
172					t = $el.offset().top + 10 - that.$.container.offset().top;
173					margin = 20;
174
175					$legend.html($el.html()).removeClass("hidden");
176
177					if (l > that.$.container.width() * 0.85)
178					{
179						l = $el.offset().left - $legend.outerWidth() - 1.5*$el.width();
180						margin = -margin;
181					}
182
183					$legend.css({top:t+"px",left:l+margin+"px",opacity:0});
184					TweenLite.to($legend, 0.2, {left:l+"px",opacity:1});
185				}
186				else if (event.type == "mouseleave" && $el.hasClass('pin'))
187				{
188
189					l = $el.offset().left;
190
191					if (l > that.$.container.width() * 0.85)
192					{
193						l = $el.offset().left - $legend.outerWidth() - 1.5*$el.width();
194					}
195
196					TweenLite.to($legend, 0.2, {left:l+margin+"px",opacity:0,onComplete:
197						function()
198						{
199							$legend.addClass("hidden");
200						}
201					});
202
203				}
204			});
205
206			/*
207			this.$.contentFloors.on(CONF.s.clickEvent,"div.icon a",function(event)
208			{
209				var $el = $(this);
210
211				event.preventDefault();
212				event.stopPropagation();
213
214				if ($el.data("template")==CONF.s.TEMPLATE_EXPLORER)
215				{
216					that.createPopinExplorerDetails("hidden");
217					that.loadExplorerDetails($el.attr("href"));
218				}
219				else
220					that.trigger(that.EVENT.LOAD_PAGE,{href:$el.attr("href")});
221			});
222*/
223		},
224
225	});
226 }());

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.