From 00a6e9fd4657257c61f4227b48e7141a96db6780 Mon Sep 17 00:00:00 2001 From: legoboyvdlp R Date: Fri, 9 Oct 2020 20:50:46 +0100 Subject: [PATCH] I dislike inkscape clipping. Just saying. --- Models/Instruments/Upper-ECAM/Upper-ECAM.nas | 38 +++++++++++++++++-- .../Instruments/Upper-ECAM/res/cfm-eis2.svg | 14 +++++-- 2 files changed, 46 insertions(+), 6 deletions(-) diff --git a/Models/Instruments/Upper-ECAM/Upper-ECAM.nas b/Models/Instruments/Upper-ECAM/Upper-ECAM.nas index 66a4bd74..126cfea1 100644 --- a/Models/Instruments/Upper-ECAM/Upper-ECAM.nas +++ b/Models/Instruments/Upper-ECAM/Upper-ECAM.nas @@ -45,6 +45,8 @@ var flapXOffset = props.globals.getNode("/ECAM/Upper/FlapX", 1); var flapYOffset = props.globals.getNode("/ECAM/Upper/FlapY", 1); var slatXOffset = props.globals.getNode("/ECAM/Upper/SlatX", 1); var slatYOffset = props.globals.getNode("/ECAM/Upper/SlatY", 1); +var flapXTranslate = props.globals.getNode("/ECAM/Upper/FlapXtrans", 1); +var flapYTranslate = props.globals.getNode("/ECAM/Upper/FlapYtrans", 1); var ECAM_line1 = props.globals.getNode("/ECAM/msg/line1", 1); var ECAM_line2 = props.globals.getNode("/ECAM/msg/line2", 1); var ECAM_line3 = props.globals.getNode("/ECAM/msg/line3", 1); @@ -123,6 +125,21 @@ var canvas_upperECAM_base = { var svg_keys = me.getKeys(); foreach(var key; svg_keys) { me[key] = canvas_group.getElementById(key); + + var clip_el = canvas_group.getElementById(key ~ "_clip"); + if (clip_el != nil) { + clip_el.setVisible(0); + var tran_rect = clip_el.getTransformedBounds(); + + var clip_rect = sprintf("rect(%d,%d, %d,%d)", + tran_rect[1], # 0 ys + tran_rect[2], # 1 xe + tran_rect[3], # 2 ye + tran_rect[0]); #3 xs + # coordinates are top,right,bottom,left (ys, xe, ye, xs) ref: l621 of simgear/canvas/CanvasElement.cxx + me[key].set("clip", clip_rect); + me[key].set("clip-frame", canvas.Element.PARENT); + } } # set font @@ -303,7 +320,7 @@ var canvas_upperECAM_base = { me["FlapIndicator"].setTranslation(flapXOffset.getValue(),flapYOffset.getValue()); me["SlatIndicator"].setTranslation(slatXOffset.getValue(),slatYOffset.getValue()); - + me["FlapLine"].setTranslation(flapXTranslate.getValue(),flapYTranslate.getValue()); # FOB if (acconfig_weight_kgs.getValue()) { @@ -352,7 +369,7 @@ var canvas_upperECAM_cfm_eis2 = { "EGT1-XX","N21","N21-decpnt","N21-decimal","N21-XX","FF1","FF1-XX","N12-needle","N12-thr","N12-ylim","N12","N12-decpnt","N12-decimal","N12-box","N12-scale","N12-scale2","N12-scaletick","N12-scalenum","N12-XX","N12-XX2","N12-XX-box","EGT2-needle","EGT2", "EGT2-scale","EGT2-box","EGT2-scale2","EGT2-scaletick","EGT2-XX","N22","N22-decpnt","N22-decimal","N22-XX","FF2","FF2-XX","FOB-LBS","FlapTxt","FlapDots","N1Lim-mode","N1Lim","N1Lim-decpnt","N1Lim-decimal","N1Lim-percent","N1Lim-XX","N1Lim-XX2","REV1", "REV1-box","REV2","REV2-box","ECAM_Left","ECAML1","ECAML2","ECAML3","ECAML4","ECAML5","ECAML6","ECAML7","ECAML8","ECAMR1", "ECAMR2", "ECAMR3", "ECAMR4", "ECAMR5", "ECAMR6", "ECAMR7", "ECAMR8", "ECAM_Right", - "FOB-weight-unit","FFlow-weight-unit","SlatAlphaLock","SlatIndicator","FlapIndicator"]; + "FOB-weight-unit","FFlow-weight-unit","SlatAlphaLock","SlatIndicator","FlapIndicator","SlatLine","FlapLine"]; }, update: func() { # N1 @@ -611,7 +628,7 @@ var canvas_upperECAM_iae_eis2 = { "EPR2-decimal","EPR2-box","EPR2-scale","EPR2-scaletick","EPR2-scalenum","EPR2-XX","EPR2-XX2","EGT2-needle","EGT2","EGT2-scale","EGT2-scale2","EGT2-box","EGT2-scaletick","EGT2-XX","N12-needle","N12-thr","N12-ylim","N12","N12-decpnt","N12-decimal", "N12-scale","N12-scale2","N12-scaletick","N12-scalenum","N12-XX","N22","N22-decpnt","N22-decimal","N22-XX","FF2","FF2-XX","FOB-LBS","FlapTxt","FlapDots","EPRLim-mode","EPRLim","EPRLim-decpnt","EPRLim-decimal","EPRLim-XX","EPRLim-XX2","REV1","REV1-box", "REV2","REV2-box","ECAM_Left","ECAML1","ECAML2","ECAML3","ECAML4","ECAML5","ECAML6","ECAML7","ECAML8", "ECAMR1", "ECAMR2", "ECAMR3", "ECAMR4", "ECAMR5", "ECAMR6", "ECAMR7", "ECAMR8", "ECAM_Right", - "FFlow1-weight-unit", "FFlow2-weight-unit", "FOB-weight-unit","SlatAlphaLock"]; + "FFlow1-weight-unit", "FFlow2-weight-unit", "FOB-weight-unit","SlatAlphaLock","SlatIndicator","FlapIndicator","SlatLine","FlapLine"]; }, update: func() { N1_1_cur = N1_1.getValue(); @@ -934,6 +951,21 @@ var canvas_upperECAM_test = { var svg_keys = me.getKeys(); foreach(var key; svg_keys) { me[key] = canvas_group.getElementById(key); + + var clip_el = canvas_group.getElementById(key ~ "_clip"); + if (clip_el != nil) { + clip_el.setVisible(0); + var tran_rect = clip_el.getTransformedBounds(); + + var clip_rect = sprintf("rect(%d,%d, %d,%d)", + tran_rect[1], # 0 ys + tran_rect[2], # 1 xe + tran_rect[3], # 2 ye + tran_rect[0]); #3 xs + # coordinates are top,right,bottom,left (ys, xe, ye, xs) ref: l621 of simgear/canvas/CanvasElement.cxx + me[key].set("clip", clip_rect); + me[key].set("clip-frame", canvas.Element.PARENT); + } } me.page = canvas_group; diff --git a/Models/Instruments/Upper-ECAM/res/cfm-eis2.svg b/Models/Instruments/Upper-ECAM/res/cfm-eis2.svg index d200bfac..fa3db1f7 100644 --- a/Models/Instruments/Upper-ECAM/res/cfm-eis2.svg +++ b/Models/Instruments/Upper-ECAM/res/cfm-eis2.svg @@ -41,9 +41,9 @@ inkscape:window-height="705" id="namedview371" showgrid="true" - inkscape:zoom="45.254834" - inkscape:cx="924.41731" - inkscape:cy="570.58297" + inkscape:zoom="1.4142136" + inkscape:cx="990.71576" + inkscape:cy="484.51174" inkscape:window-x="-8" inkscape:window-y="-8" inkscape:window-maximized="1" @@ -1412,4 +1412,12 @@ d="m 530.43575,645.52404 24.69434,-5.55908 -11.10498,15.46142 -24.69434,5.56055 z" id="SlatIndicator" inkscape:label="#path1114" /> +