From e713f3505f9f70b30584b5e26efc748a3174abb7 Mon Sep 17 00:00:00 2001
From: Lucio Zambon <lucio.zambon@elettra.eu>
Date: Fri, 17 Jan 2025 02:16:22 +0000
Subject: [PATCH] Update simulator2d.js

---
 simulator2d.js | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)

diff --git a/simulator2d.js b/simulator2d.js
index d433dee..69e9ee5 100644
--- a/simulator2d.js
+++ b/simulator2d.js
@@ -144,9 +144,11 @@
 			menuParams['scale H'] = simulatorFactorHor/1000;
 			scaleHor = gui.add(menuParams, 'scale H', maxVer/100, maxVer, Math.round(maxVer/1000)).onChange(function() {factorHor(menuParams['scale H'], gui);}).onFinishChange(function() {finishHor(gui);});
 			guiscale(gui, 'scaleh');
+			$('#scaleh').children().eq(0).css('color','red');
 			menuParams['scale V'] = simulatorFactorHor/1000;
 			scaleVer = gui.add(menuParams, 'scale V', maxHor/100, maxHor, Math.round(maxHor/1000)).onChange(function() {factorVer(menuParams['scale V'], gui);}).onFinishChange(function() {finishVer(gui);});
 			guiscale(gui, 'scalev');
+			$('#scalev').children().eq(0).css('color','green');
 		}
 		else {
 			const controllerOption = $('.controller.option');
@@ -281,20 +283,20 @@
 	function rulerInit() {
 		const cx=0, cy=0;
 		appendSvg("g", {id: 'rulerg'}, false, false, 'rulerclass');
-		appendSvg("line", {id: 'ruler1', x1: cx-10050, y1: cy, x2: cx+10050, y2: cy, style:"display: block", stroke:"yellow", "stroke-width":100}, false, false, 'rulerclass', '#rulerg');
+		appendSvg("line", {id: 'ruler1', x1: cx-10100, y1: cy, x2: cx+10100, y2: cy, style:"display: block", stroke:"yellow", "stroke-width":100}, false, false, 'rulerclass', '#rulerg');
 		for (let i=-10; i<=10; i++) {
 			const xt = (cx+i*1000);
 			appendSvg("line", {id: 'tick1'+(100-i), x1: xt, y1: cy, x2: xt, y2: cy+300, style:"display: block", stroke:"yellow","stroke-width":100}, false, false, 'rulerclass', '#rulerg');
 			appendSvg("text", {id: 'label'+(100-i), x: xt-300, y: cy+600, fill:"yellow", stroke:"black","stroke-width":1, "font-family":"Arial", "font-size":300, "font-weight":"bold", "text-anchor": "start"}, false, false, 'rulerclass', '#rulerg');
 			if (i) $('#label'+(100-i)).html(Math.abs(i)+' m');
 		}
-		appendSvg("line", {id: 'redruler1', x1: cx, y1: cy, x2: cx, y2: cy+10050, style:"display: block", stroke:"red", "stroke-width":100}, false, false, 'rulerclass', '#rulerg');
+		appendSvg("line", {id: 'redruler1', x1: cx, y1: cy, x2: cx, y2: cy+10100, style:"display: block", stroke:"red", "stroke-width":100}, false, false, 'rulerclass', '#rulerg');
 		for (let i=0; i<=10; i++) {
 			const yt = (cy+i*1000);
 			appendSvg("line", {id: 'redtick1'+(100-i), x1: cx, y1: yt, x2: cx+300, y2: yt, style:"display: block", stroke:"red","stroke-width":100}, false, false, 'rulerclass', '#rulerg');
 			appendSvg("text", {id: 'redlabel'+(100-i), x: cx+400, y: yt, fill:"red", stroke:"black","stroke-width":1, "font-family":"Arial", "font-size":300, "font-weight":"bold", "text-anchor": "start"}, false, false, 'rulerclass', '#rulerg');
 		}
-		appendSvg("line", {id: 'greenruler1', x1: cx, y1: cy, x2: cx, y2: cy-10050, style:"display: block", stroke:"green", "stroke-width":100}, false, false, 'rulerclass', '#rulerg');
+		appendSvg("line", {id: 'greenruler1', x1: cx, y1: cy, x2: cx, y2: cy-10100, style:"display: block", stroke:"green", "stroke-width":100}, false, false, 'rulerclass', '#rulerg');
 		for (let i=0; i<=10; i++) {
 			const yt = (cy-i*1000);
 			appendSvg("line", {id: 'greentick1'+(100-i), x1: cx, y1: yt, x2: cx+300, y2: yt, style:"display: block", stroke:"green","stroke-width":100}, false, false, 'rulerclass', '#rulerg');
@@ -312,7 +314,15 @@
 		}
 		simulatorData.reader = false;
 		if (params.simulator=='position') {
-			$('#applicationFrame').attr("src", $('#applicationFrame').attr("data-src"));
+			if (machine=='elettra') {
+				if (document.location.host!="mac3d.elettra.eu") {
+					$('#applicationFrame').attr("src", 'https://puma-01.elettra.eu/spa/index.html?s=miniSynoptic');
+					$('#applicationFrame').css("height", '1000px');
+				}
+			}
+			else {
+				$('#applicationFrame').attr("src", $('#applicationFrame').attr("data-src"));
+			} 
 		}
 		else {
 			$('#applicationFrame').removeAttr("src");
-- 
GitLab