joystick.PropertyScaleAxis.parse(): copy the property name too
- Since joystick.PropertyScaleAxis instances have a 'prop' attribute indicating the property name, it seems logical to have joystick.PropertyScaleAxis.parse() set this attribute based on the property name in its argument ('p'). - This commit also tries to improve readability by using a 'bindingNode' variable instead of repeatedly calling 'p.getNode("binding", 1)'.
This commit is contained in:
parent
769a83e64f
commit
2cf6cf4a93
1 changed files with 6 additions and 3 deletions
|
@ -127,13 +127,16 @@ var PropertyScaleAxis = {
|
|||
},
|
||||
|
||||
parse: func(p) {
|
||||
# Don't create a null 'factor' node if it doesn't exist!
|
||||
bindingNode = p.getNode("binding", 1);
|
||||
me.prop = bindingNode.getNode("property", 1).getValue();
|
||||
|
||||
# Don't create an empty 'factor' node if it doesn't exist!
|
||||
# (value 0 wouldn't be appropriate for a default factor)
|
||||
factorNode = p.getNode("binding", 1).getNode("factor", 0);
|
||||
factorNode = bindingNode.getNode("factor", 0);
|
||||
me.factor = (factorNode != nil) ? factorNode.getValue() : 1.0;
|
||||
|
||||
me.inverted = (me.factor < 0);
|
||||
me.offset = p.getNode("binding", 1).getNode("offset", 1).getValue();
|
||||
me.offset = bindingNode.getNode("offset", 1).getValue();
|
||||
},
|
||||
|
||||
getBinding: func(axis) {
|
||||
|
|
Loading…
Reference in a new issue