marker-adjust
vbox
-20
-20
hbox
1
1
var self = cmdarg();
var dlgname = self.getNode("name").getValue();
var Value = {
new : func(name, init = 0) {
var m = { parents: [Value] };
m.name = name;
var n = props.globals.getNode("/sim/model/marker/" ~ m.name, 1);
m.sliderN = n.getNode("slider", 1);
m.offsetN = n.getNode("offset", 1);
m.valueN = n.getNode("value", 1);
m.offsetN.setDoubleValue(0);
m.sliderN.setDoubleValue(0);
m.valueN.setDoubleValue(init);
m.last_slider = 0;
m.center();
m.sliderL = setlistener(m.sliderN, func { m.update() });
return m;
},
del : func {
removelistener(me.sliderL);
},
update : func {
var offs = me.sliderN.getValue();
var v = me.offsetN.getValue() + me.sliderN.getValue() - me.last_slider;
me.valueN.setValue(me.valueN.getValue() + v * 0.1);
me.offsetN.setDoubleValue(0);
me.last_slider = offs;
},
center : func {
me.offsetN.setValue(me.offsetN.getValue() + me.sliderN.getValue());
me.sliderN.setDoubleValue(0);
},
};
var values = [
Value.new("x"),
Value.new("y"),
Value.new("z"),
Value.new("scale", 1),
];
var center = func {
foreach (var v; values) {
v.center();
}
}
var dump = func {
print("<marker>");
foreach (var v; values) {
print(sprintf(" <%s>%.3f</%s>", v.name, v.valueN.getValue(), v.name));
}
print("</marker>");
}
var update = func(w) {
self.setValues({"dialog-name": dlgname, "object-name": w});
fgcommand("dialog-update", self);
center();
}
setprop("/sim/model/marker/arrow-enabled", 1);
setprop("/sim/model/marker/cross-enabled", 1);
setprop("/sim/model/marker/cross-enabled", 0);
setprop("/sim/model/marker/arrow-enabled", 0);
foreach (var v; values) {
v.del();
}
hbox
0
x
/sim/model/marker/x/slider
250
1
-1
1
1.0
0.6
0.6
1
dialog-apply
x
hbox
0
y
/sim/model/marker/y/slider
250
1
-1
1
0.6
1.0
0.6
1.0
dialog-apply
y
hbox
0
z
/sim/model/marker/z/slider
250
1
-1
1
0.6
0.6
1.0
1.0
dialog-apply
z
hbox
0
scale
/sim/model/marker/scale/slider
250
1
-1
1
1.0
0.6
1.0
1.0
dialog-apply
scale
hbox
2
1
1