Rivista UI
This commit is contained in:
@@ -140,4 +140,9 @@ h1:focus { outline: none; }
|
||||
.mud-button-group-horizontal:not(.mud-button-group-rtl) > .mud-button-root:not(:first-child), .mud-button-group-horizontal:not(.mud-button-group-rtl) > :not(:first-child) .mud-button-root {
|
||||
border-top-left-radius: 0 !important;
|
||||
border-bottom-left-radius: 0 !important;
|
||||
}
|
||||
|
||||
.customDialog-form .mud-dialog-content {
|
||||
padding: 0 .75rem;
|
||||
margin: 0;
|
||||
}
|
||||
@@ -4,4 +4,5 @@
|
||||
--gray-for-shadow: hsl(from var(--mud-palette-gray-light) h s 95%);
|
||||
/*Utility*/
|
||||
--card-shadow: 5px 5px 10px 0 var(--gray-for-shadow);
|
||||
}
|
||||
--custom-box-shadow: 1px 2px 5px rgba(165, 165, 165, 0.5);
|
||||
}
|
||||
@@ -1,41 +1,56 @@
|
||||
window.calendarSwipe = {
|
||||
register: function (element, dotnetHelper) {
|
||||
let startX = 0;
|
||||
let endX = 0;
|
||||
let startX = 0, startY = 0;
|
||||
let endX = 0, endY = 0;
|
||||
|
||||
// Touch events
|
||||
element.addEventListener('touchstart', (e) => {
|
||||
if (e.touches.length === 1) {
|
||||
startX = e.touches[0].clientX;
|
||||
startY = e.touches[0].clientY;
|
||||
}
|
||||
});
|
||||
|
||||
element.addEventListener('touchend', (e) => {
|
||||
if (e.changedTouches.length === 1) {
|
||||
endX = e.changedTouches[0].clientX;
|
||||
endY = e.changedTouches[0].clientY;
|
||||
handle();
|
||||
}
|
||||
});
|
||||
|
||||
// Per desktop: mouse drag
|
||||
// Mouse events
|
||||
let mouseDown = false;
|
||||
element.addEventListener('mousedown', (e) => {
|
||||
if (e.button !== 0) return; // solo left mouse
|
||||
if (e.button !== 0) return;
|
||||
mouseDown = true;
|
||||
startX = e.clientX;
|
||||
startY = e.clientY;
|
||||
});
|
||||
|
||||
element.addEventListener('mouseup', (e) => {
|
||||
if (!mouseDown) return;
|
||||
mouseDown = false;
|
||||
endX = e.clientX;
|
||||
endY = e.clientY;
|
||||
handle();
|
||||
});
|
||||
|
||||
function handle() {
|
||||
let diff = endX - startX;
|
||||
if (Math.abs(diff) > 40) {
|
||||
if (diff < 0) dotnetHelper.invokeMethodAsync('OnSwipeLeft');
|
||||
else dotnetHelper.invokeMethodAsync('OnSwipeRight');
|
||||
let diffX = endX - startX;
|
||||
let diffY = endY - startY;
|
||||
|
||||
if (Math.abs(diffX) > Math.abs(diffY)) {
|
||||
if (Math.abs(diffX) > 40) {
|
||||
if (diffX < 0) dotnetHelper.invokeMethodAsync('OnSwipeLeft');
|
||||
else dotnetHelper.invokeMethodAsync('OnSwipeRight');
|
||||
}
|
||||
} else {
|
||||
if (Math.abs(diffY) > 40) {
|
||||
if (diffY < 0) dotnetHelper.invokeMethodAsync('OnSwipeUp');
|
||||
else dotnetHelper.invokeMethodAsync('OnSwipeDown');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user