2023-10-30 04:18:18 +01:00
|
|
|
function value_snap_real(val, snap = 1) {
|
2023-12-05 13:49:18 +01:00
|
|
|
INLINE
|
2023-10-30 04:18:18 +01:00
|
|
|
return snap == 0? val : round(val / snap) * snap;
|
|
|
|
}
|
|
|
|
|
2023-03-19 09:17:39 +01:00
|
|
|
function value_snap(val, snap = 1) {
|
2023-12-05 13:49:18 +01:00
|
|
|
INLINE
|
2023-08-22 11:51:45 +02:00
|
|
|
|
2023-10-30 04:18:18 +01:00
|
|
|
if(!is_array(val))
|
|
|
|
return value_snap_real(val, snap);
|
2023-08-22 11:51:45 +02:00
|
|
|
|
|
|
|
var _val = [];
|
|
|
|
for( var i = 0, n = array_length(val); i < n; i++ )
|
2023-10-30 04:18:18 +01:00
|
|
|
_val[i] = value_snap(val[i], snap);
|
2023-08-22 11:51:45 +02:00
|
|
|
return _val;
|
2022-12-19 13:35:30 +01:00
|
|
|
}
|