1
0
Fork 0

I dislike inkscape clipping. Just saying.

This commit is contained in:
legoboyvdlp R 2020-10-09 20:50:46 +01:00
parent 079db179f9
commit 00a6e9fd46
2 changed files with 46 additions and 6 deletions

View file

@ -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;

View file

@ -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" />
<rect
style="opacity:0.5;fill:none;fill-opacity:1;stroke:none;stroke-width:4.07583141;stroke-linecap:square;stroke-linejoin:bevel;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:markers stroke fill"
id="FlapLine_clip"
width="193.06065"
height="50.843338"
x="718.86694"
y="594.42938"
inkscape:label="#rect1023" />
</svg>

Before

Width:  |  Height:  |  Size: 86 KiB

After

Width:  |  Height:  |  Size: 86 KiB