Compare commits
No commits in common. "4aeb97a79e2e907eec4a11e23c8c9b9a0751ed09" and "8913ccc3ce628e19976a808a8b05b922ed2e20ef" have entirely different histories.
4aeb97a79e
...
8913ccc3ce
|
@ -10,9 +10,6 @@ import org.w3c.dom.*
|
|||
import kotlin.browser.document
|
||||
import kotlin.browser.window
|
||||
import kotlin.js.Date
|
||||
import kotlin.math.abs
|
||||
import kotlin.math.max
|
||||
import kotlin.math.min
|
||||
|
||||
class Calendar(calendar: HTMLElement) : View(calendar) {
|
||||
|
||||
|
@ -21,8 +18,6 @@ class Calendar(calendar: HTMLElement) : View(calendar) {
|
|||
val calendarTable = calendar.getElementsByClassName("calendar-table")[0] as HTMLElement
|
||||
private val calendarTableHeader = calendar.getElementsByClassName("calendar-header")[0] as HTMLElement
|
||||
|
||||
val htmlBody = document.body ?: createHtmlView()
|
||||
|
||||
val day = calendarTable.dataset["day"]?.toIntOrNull() ?: -1
|
||||
val referenceDate = calendarTable.dataset["reference"]?.toLongOrNull() ?: -1L
|
||||
val nowDate = calendarTable.dataset["now"]?.toLongOrNull() ?: -1L
|
||||
|
@ -116,34 +111,8 @@ class Calendar(calendar: HTMLElement) : View(calendar) {
|
|||
else -> 1.0
|
||||
}
|
||||
|
||||
var verticalScroll = it.deltaY * multiplier
|
||||
|
||||
if (verticalScroll > 0) {
|
||||
val x = html.offsetTop - htmlBody.scrollTop
|
||||
if (x > 0) {
|
||||
val bodyScroll = min(x, verticalScroll)
|
||||
verticalScroll -= bodyScroll
|
||||
htmlBody.scrollBy(ScrollToOptions(0.0, bodyScroll, ScrollBehavior.INSTANT))
|
||||
} else {
|
||||
if (calendarTable.scrollTop + calendarTable.clientHeight + 5 >= calendarTable.scrollHeight) {
|
||||
htmlBody.scrollBy(ScrollToOptions(0.0, verticalScroll, ScrollBehavior.INSTANT))
|
||||
}
|
||||
}
|
||||
} else if (verticalScroll < 0) {
|
||||
val x = html.offsetTop - htmlBody.scrollTop
|
||||
if (x < 0) {
|
||||
val bodyScroll = max(x, verticalScroll)
|
||||
verticalScroll -= bodyScroll
|
||||
htmlBody.scrollBy(ScrollToOptions(0.0, bodyScroll, ScrollBehavior.INSTANT))
|
||||
} else {
|
||||
if (calendarTable.scrollTop == 0.0) {
|
||||
htmlBody.scrollBy(ScrollToOptions(0.0, verticalScroll, ScrollBehavior.INSTANT))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
scrollHorizontalBy(it.deltaX * multiplier, ScrollBehavior.INSTANT)
|
||||
scrollVerticalBy(verticalScroll, ScrollBehavior.INSTANT)
|
||||
scrollVerticalBy(it.deltaY * multiplier, ScrollBehavior.INSTANT)
|
||||
|
||||
it.preventDefault()
|
||||
}
|
||||
|
|
|
@ -60,10 +60,6 @@ class CalendarEdit(
|
|||
}
|
||||
}
|
||||
|
||||
onWheel {
|
||||
it.stopPropagation()
|
||||
}
|
||||
|
||||
WorkGroupRepository.onCreate {
|
||||
if (loaded) {
|
||||
launch {
|
||||
|
|
|
@ -174,8 +174,7 @@ class CalendarEntry(private val calendar: CalendarBody, view: HTMLElement) : Vie
|
|||
|
||||
init {
|
||||
onMouseDown { event ->
|
||||
val isValidTarget = event.target == html || event.target == nameView
|
||||
if (!editable || !isValidTarget || "pending" in classList) {
|
||||
if (!editable || event.target != html || "pending" in classList) {
|
||||
event.stopPropagation()
|
||||
return@onMouseDown
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue