mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-12-04 13:02:50 -05:00
Scripts: reflect reports matrix defaults; copy notes keep the recording limit
- app.reflect now reports the defaults of the matrix functions' number arguments: 0 for deltaX, deltaY and angle, and 100 for scaleX, in the get and concatenate variants. scaleY has no fixed default, since a left-out vertical scale is the horizontal one; its description says so. - When a script's commands take a recording past its limit and the script also copied, the notes of the Copy's formats no longer replace the limit message in the status bar. The limit is named only once, so the message is kept while it shows. The same applies to a script run that automation takes to its end at once.
This commit is contained in:
1 parent
40b27cd756
commit
efdaa06fd2
5 files changed
+80
-2
No files matched your search
@@ -19,7 +19,7 @@
|
||||
//! - An argument that is not a finite number, or a matrix with a value that is not one, throws a
|
||||
//! `TypeError`; a result with a value too large for a number throws a `RangeError`.
|
||||
|
||||
use vectorcraft_js::{Data, HostError};
|
||||
use vectorcraft_js::{Data, HostError, MemberInfo};
|
||||
|
||||
use super::{Answer, Described, Host, Link, arg, method, named, num, returns, text};
|
||||
|
||||
@@ -54,6 +54,24 @@ pub(super) fn app_members(link: &Link) -> Vec<Described> {
|
||||
("isEqualMatrix", method(l, is_equal), returns("boolean", &[("matrix", "Matrix"), ("secondMatrix", "Matrix")])),
|
||||
("isSingularMatrix", method(l, is_singular), returns("boolean", &[("matrix", "Matrix")])),
|
||||
])
|
||||
.into_iter()
|
||||
.map(|(name, member, info)| (name, member, with_defaults(info)))
|
||||
.collect()
|
||||
}
|
||||
|
||||
/// `info` with the defaults of its left-out number arguments, which `reflect` reports: 0 for a
|
||||
/// translation and an angle, 100 for a horizontal scale. A left-out vertical scale is the
|
||||
/// horizontal one, so it has no fixed default and its description says so.
|
||||
fn with_defaults(mut info: MemberInfo) -> MemberInfo {
|
||||
for a in &mut info.arguments {
|
||||
match a.name.as_str() {
|
||||
"deltaX" | "deltaY" | "angle" => a.default = Some(num(0.0)),
|
||||
"scaleX" => a.default = Some(num(100.0)),
|
||||
"scaleY" => a.description = Some("The vertical scale; when it is left out, the horizontal scale.".into()),
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
info
|
||||
}
|
||||
|
||||
/// The record for `m`, or a `RangeError` when a value is not finite.
|
||||
|
||||
Reference in new issue
Block a user