ui/autolayout/layoutterm
식의 한 항. (원본 ui/autolayout/layoutterm.js 의 LayoutTerm, coefficient * variable)
- LayoutExpression 을 이루는 값이다. 바뀌지 않는다.
- 원본과 다른 것:
- 원본은 변수 없이(null, 값 0) 만들 수 있고 솔버는 그런 항을 건너뛴다. 러스트 판은 늘 변수를 받아 그런 항이 없다.
- 생략할 수 있던 coefficient(기본 1)는 꼭 받는다.
One term of an expression. (LayoutTerm of the original ui/autolayout/layoutterm.js, coefficient * variable)
- A value making up a LayoutExpression. It does not change.
- Differences from the original:
- The original can be created without a variable (null, value 0) and the solver skips such terms. The Rust version always takes a variable, so there are no such terms.
- coefficient, which could be omitted (default 1), is required.
LayoutTermstruct traits Clone, Debug
식의 한 항.
One term of an expression.
use vanilla::{LayoutExpression, LayoutTerm, LayoutVariable};
let width = LayoutVariable::new("width");
width.set_value(80.0);
let half_width = LayoutTerm::new(width.clone(), 0.5);
assert_eq!(half_width.get_variable(), &width);
assert_eq!(half_width.get_value(), 40.0);
let expression = LayoutExpression::from(half_width).add(10);
assert_eq!(expression.get_value(), 50.0);생성.
Constructor.
- variableLayoutVariable
- 항의 변수. (핸들을 그대로 쥔다)The term's variable. (holds the handle as is)
- coefficientf64
- 변수에 곱할 계수.Coefficient to multiply the variable by.
반환ReturnsLayoutTerm 새 항.New term.
짝Counterpart: vanilla.js LayoutTerm.constructor
변수 반환.
Returns the variable.
반환Returns&LayoutVariable 항이 쥔 변수 핸들의 참조.Reference to the variable handle the term holds.
짝Counterpart: vanilla.js LayoutTerm.getVariable
계수 반환.
Returns the coefficient.
반환Returnsf64 계수.Coefficient.
짝Counterpart: vanilla.js LayoutTerm.getCoefficient
평가 값 반환. (coefficient * 변수 값)
Returns the evaluated value. (coefficient * variable value)
반환Returnsf64 계수 * 변수의 지금 값.Coefficient * current variable value.
짝Counterpart: vanilla.js LayoutTerm.getValue