Added Statistics calculation
Statistics now show calculated values
This commit is contained in:
parent
fe87374e47
commit
fc0f69dacb
2147 changed files with 141321 additions and 39 deletions
60
node_modules/@mui/x-date-pickers/TimeClock/shared.js
generated
vendored
Normal file
60
node_modules/@mui/x-date-pickers/TimeClock/shared.js
generated
vendored
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.getMinutes = exports.getHours = exports.CLOCK_WIDTH = exports.CLOCK_HOUR_WIDTH = void 0;
|
||||
const CLOCK_WIDTH = exports.CLOCK_WIDTH = 220;
|
||||
const CLOCK_HOUR_WIDTH = exports.CLOCK_HOUR_WIDTH = 36;
|
||||
const clockCenter = {
|
||||
x: CLOCK_WIDTH / 2,
|
||||
y: CLOCK_WIDTH / 2
|
||||
};
|
||||
const baseClockPoint = {
|
||||
x: clockCenter.x,
|
||||
y: 0
|
||||
};
|
||||
const cx = baseClockPoint.x - clockCenter.x;
|
||||
const cy = baseClockPoint.y - clockCenter.y;
|
||||
const rad2deg = rad => rad * (180 / Math.PI);
|
||||
const getAngleValue = (step, offsetX, offsetY) => {
|
||||
const x = offsetX - clockCenter.x;
|
||||
const y = offsetY - clockCenter.y;
|
||||
const atan = Math.atan2(cx, cy) - Math.atan2(x, y);
|
||||
let deg = rad2deg(atan);
|
||||
deg = Math.round(deg / step) * step;
|
||||
deg %= 360;
|
||||
const value = Math.floor(deg / step) || 0;
|
||||
const delta = x ** 2 + y ** 2;
|
||||
const distance = Math.sqrt(delta);
|
||||
return {
|
||||
value,
|
||||
distance
|
||||
};
|
||||
};
|
||||
const getMinutes = (offsetX, offsetY, step = 1) => {
|
||||
const angleStep = step * 6;
|
||||
let {
|
||||
value
|
||||
} = getAngleValue(angleStep, offsetX, offsetY);
|
||||
value = value * step % 60;
|
||||
return value;
|
||||
};
|
||||
exports.getMinutes = getMinutes;
|
||||
const getHours = (offsetX, offsetY, ampm) => {
|
||||
const {
|
||||
value,
|
||||
distance
|
||||
} = getAngleValue(30, offsetX, offsetY);
|
||||
let hour = value || 12;
|
||||
if (!ampm) {
|
||||
if (distance < CLOCK_WIDTH / 2 - CLOCK_HOUR_WIDTH) {
|
||||
hour += 12;
|
||||
hour %= 24;
|
||||
}
|
||||
} else {
|
||||
hour %= 12;
|
||||
}
|
||||
return hour;
|
||||
};
|
||||
exports.getHours = getHours;
|
||||
Loading…
Add table
Add a link
Reference in a new issue