1
0
Fork 0

Add props.nas getDoubleValue(), getIntValue()

Also fixed an issue with whitespace around view parameters.
This commit is contained in:
Stuart Buchanan 2019-09-22 21:14:07 +01:00
parent f83caf7e45
commit 01dc9d0b38
2 changed files with 44 additions and 36 deletions

View file

@ -52,6 +52,14 @@ var Node = {
return !!val;
},
getIntValue : func {
return math.round(me.getValue());
},
getDoubleValue : func {
return num(me.getValue());
},
remove : func {
if((var p = me.getParent()) == nil) return nil;
p.removeChild(me.getName(), me.getIndex());

View file

@ -875,7 +875,7 @@ var screenWidthCompens = {
setStatus: func(state) me.statusNode.setValue(state),
wNode: nil, # = /sim/startup/xsize
hNode: nil, # = /sim/startup/ysize
getDimensions: func [me.wNode.getValue(),me.hNode.getValue()],
getDimensions: func [me.wNode.getDoubleValue(),me.hNode.getDoubleValue()],
calcNewFov: func(fov=55, oldW=nil, oldH=nil, w=nil, h=nil) {
var dim = me.getDimensions();
if (w == nil) w = dim[0];
@ -894,7 +894,7 @@ var screenWidthCompens = {
setsize(me.fovStore, size(views));
forindex (var i; views) {
me.fovStore[i] = views[i].getNode("config/default-field-of-view-deg", 1).getValue() or 55;
me.fovStore[i] = views[i].getNode("config/default-field-of-view-deg", 1).getDoubleValue() or 55;
me.lastViewStatus[i] = { w:me.assumedW, h:me.assumedH };
}
me.update(opt:nil, force:1);