mirror of
https://github.com/omnivore-app/omnivore.git
synced 2026-03-11 08:54:26 +00:00
adjust menu location with toolbar height. user screenx/y to store tap location
This commit is contained in:
parent
fde9528996
commit
bc1ddd5681
6 changed files with 13 additions and 10 deletions
File diff suppressed because one or more lines are too long
|
|
@ -88,6 +88,7 @@ fun WebReaderLoadingContainer(slug: String, webReaderViewModel: WebReaderViewMod
|
|||
TopAppBar(
|
||||
modifier = Modifier
|
||||
.height(height = with(LocalDensity.current) {
|
||||
webReaderViewModel.currentToolbarHeight = toolbarHeightPx.value.toInt()
|
||||
toolbarHeightPx.value.roundToInt().toDp()
|
||||
} ),
|
||||
backgroundColor = MaterialTheme.colorScheme.surfaceVariant,
|
||||
|
|
@ -316,12 +317,12 @@ class OmnivoreWebView(context: Context) : WebView(context) {
|
|||
if (viewModel?.lastTapCoordinates != null) {
|
||||
val scrollYOffset = viewModel?.scrollState?.value ?: 0
|
||||
val xValue = viewModel!!.lastTapCoordinates!!.tapX.toInt()
|
||||
val yValue = viewModel!!.lastTapCoordinates!!.tapY.toInt() + scrollYOffset
|
||||
val yValue = viewModel!!.lastTapCoordinates!!.tapY.toInt() + scrollYOffset + (viewModel?.currentToolbarHeight ?: 0)
|
||||
val rect = Rect(xValue, yValue, xValue, yValue)
|
||||
|
||||
Log.d("wv", "scrollState: $scrollYOffset")
|
||||
Log.d("wv", "setting rect based on last tapped rect: ${viewModel?.lastTapCoordinates.toString()}")
|
||||
Log.d("wv", "rect: $rect")
|
||||
Log.d("wvt", "scrollState: ${viewModel?.scrollState?.value}, bar height: ${viewModel?.currentToolbarHeight}")
|
||||
Log.d("wvt", "setting rect based on last tapped rect: ${viewModel?.lastTapCoordinates.toString()}")
|
||||
Log.d("wvt", "rect: $rect")
|
||||
|
||||
outRect?.set(rect)
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package app.omnivore.omnivore.ui.reader
|
|||
|
||||
import android.util.Log
|
||||
import androidx.compose.foundation.ScrollState
|
||||
import androidx.compose.ui.unit.Density
|
||||
import androidx.lifecycle.MutableLiveData
|
||||
import androidx.lifecycle.ViewModel
|
||||
import androidx.lifecycle.viewModelScope
|
||||
|
|
@ -33,6 +34,7 @@ class WebReaderViewModel @Inject constructor(
|
|||
var lastJavascriptActionLoopUUID: UUID = UUID.randomUUID()
|
||||
var javascriptDispatchQueue: MutableList<String> = mutableListOf()
|
||||
var scrollState = ScrollState(0)
|
||||
var currentToolbarHeight = 0
|
||||
|
||||
val webReaderParamsLiveData = MutableLiveData<WebReaderParams?>(null)
|
||||
val annotationLiveData = MutableLiveData<String?>(null)
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -275,8 +275,8 @@ export function HighlightsLayer(props: HighlightsLayerProps): JSX.Element {
|
|||
}
|
||||
|
||||
const tapAttributes = {
|
||||
tapX: event.clientX,
|
||||
tapY: event.clientY,
|
||||
tapX: event.screenX,
|
||||
tapY: event.screenY,
|
||||
}
|
||||
|
||||
window?.AndroidWebKitMessenger?.handleIdentifiableMessage(
|
||||
|
|
|
|||
|
|
@ -17,8 +17,8 @@ export function useSelection(
|
|||
const handleFinishTouch = useCallback(
|
||||
async (mouseEvent) => {
|
||||
const tapAttributes = {
|
||||
tapX: mouseEvent.clientX,
|
||||
tapY: mouseEvent.clientY,
|
||||
tapX: mouseEvent.screenX,
|
||||
tapY: mouseEvent.screenY,
|
||||
}
|
||||
|
||||
window?.AndroidWebKitMessenger?.handleIdentifiableMessage(
|
||||
|
|
|
|||
Loading…
Reference in a new issue