0.3.0 #23
@ -72,7 +72,7 @@ fun App() {
|
|||||||
) {
|
) {
|
||||||
|
|
||||||
geoJson(javaClass.getResource("/moscow.geo.json")!!)
|
geoJson(javaClass.getResource("/moscow.geo.json")!!)
|
||||||
.modifyAttribute(ColorAttribute, Color.Blue)
|
.color(Color.Blue)
|
||||||
.modifyAttribute(AlphaAttribute, 0.4f)
|
.modifyAttribute(AlphaAttribute, 0.4f)
|
||||||
|
|
||||||
icon(pointOne, Icons.Filled.Home)
|
icon(pointOne, Icons.Filled.Home)
|
||||||
@ -153,8 +153,9 @@ fun App() {
|
|||||||
Color(
|
Color(
|
||||||
red = ((gmc.latitude + Angle.piDiv2).degrees * 10 % 1f).toFloat(),
|
red = ((gmc.latitude + Angle.piDiv2).degrees * 10 % 1f).toFloat(),
|
||||||
green = ((gmc.longitude + Angle.pi).degrees * 10 % 1f).toFloat(),
|
green = ((gmc.longitude + Angle.pi).degrees * 10 % 1f).toFloat(),
|
||||||
blue = 0f
|
blue = 0f,
|
||||||
).copy(alpha = 0.3f)
|
alpha = 0.3f
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
centerCoordinates.filterNotNull().onEach {
|
centerCoordinates.filterNotNull().onEach {
|
||||||
|
@ -29,7 +29,7 @@ fun App() {
|
|||||||
MaterialTheme {
|
MaterialTheme {
|
||||||
val scope = rememberCoroutineScope()
|
val scope = rememberCoroutineScope()
|
||||||
|
|
||||||
val schemeFeaturesState: FeatureGroup<XY> = FeatureGroup.remember(XYCoordinateSpace) {
|
val features: FeatureGroup<XY> = FeatureGroup.remember(XYCoordinateSpace) {
|
||||||
background(1600f, 1200f) { painterResource("middle-earth.jpg") }
|
background(1600f, 1200f) { painterResource("middle-earth.jpg") }
|
||||||
circle(410.52737 to 868.7676).color(Color.Blue)
|
circle(410.52737 to 868.7676).color(Color.Blue)
|
||||||
text(410.52737 to 868.7676, "Shire").color(Color.Blue)
|
text(410.52737 to 868.7676, "Shire").color(Color.Blue)
|
||||||
@ -53,7 +53,7 @@ fun App() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
val initialViewPoint: ViewPoint<XY> = remember {
|
val initialViewPoint: ViewPoint<XY> = remember {
|
||||||
schemeFeaturesState.getBoundingBox(1f)?.computeViewPoint() ?: XYViewPoint(XY(0f, 0f))
|
features.getBoundingBox(1f)?.computeViewPoint() ?: XYViewPoint(XY(0f, 0f))
|
||||||
}
|
}
|
||||||
|
|
||||||
var viewPoint: ViewPoint<XY> by remember { mutableStateOf(initialViewPoint) }
|
var viewPoint: ViewPoint<XY> by remember { mutableStateOf(initialViewPoint) }
|
||||||
@ -61,7 +61,7 @@ fun App() {
|
|||||||
var snapshot: FeatureStateSnapshot<XY>? by remember { mutableStateOf(null) }
|
var snapshot: FeatureStateSnapshot<XY>? by remember { mutableStateOf(null) }
|
||||||
|
|
||||||
if (snapshot == null) {
|
if (snapshot == null) {
|
||||||
snapshot = schemeFeaturesState.snapshot()
|
snapshot = features.snapshot()
|
||||||
}
|
}
|
||||||
|
|
||||||
ContextMenuArea(
|
ContextMenuArea(
|
||||||
@ -90,7 +90,7 @@ fun App() {
|
|||||||
|
|
||||||
SchemeView(
|
SchemeView(
|
||||||
mapState,
|
mapState,
|
||||||
schemeFeaturesState,
|
features,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,10 +1,12 @@
|
|||||||
kotlin.code.style=official
|
kotlin.code.style=official
|
||||||
|
|
||||||
compose.version=1.5.1
|
compose.version=1.5.1
|
||||||
#agp.version=7.4.2
|
|
||||||
#android.useAndroidX=true
|
|
||||||
org.jetbrains.compose.experimental.jscanvas.enabled=true
|
org.jetbrains.compose.experimental.jscanvas.enabled=true
|
||||||
|
|
||||||
|
agp.version=8.1.0
|
||||||
|
android.useAndroidX=true
|
||||||
|
android.enableJetifier=true
|
||||||
|
|
||||||
org.gradle.jvmargs=-Xmx4096m
|
org.gradle.jvmargs=-Xmx4096m
|
||||||
|
|
||||||
toolsVersion=0.14.9-kotlin-1.9.0
|
toolsVersion=0.14.9-kotlin-1.9.0
|
@ -1,6 +1,7 @@
|
|||||||
plugins {
|
plugins {
|
||||||
id("space.kscience.gradle.mpp")
|
id("space.kscience.gradle.mpp")
|
||||||
id("org.jetbrains.compose")
|
id("org.jetbrains.compose")
|
||||||
|
// id("com.android.library")
|
||||||
`maven-publish`
|
`maven-publish`
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -39,4 +40,4 @@ readme {
|
|||||||
feature(
|
feature(
|
||||||
id = "osm",
|
id = "osm",
|
||||||
) { "OpenStreetMap tile provider." }
|
) { "OpenStreetMap tile provider." }
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,6 @@ import org.junit.jupiter.api.Test
|
|||||||
import java.nio.file.Files
|
import java.nio.file.Files
|
||||||
import kotlin.test.assertFails
|
import kotlin.test.assertFails
|
||||||
|
|
||||||
@OptIn(ExperimentalCoroutinesApi::class)
|
|
||||||
class OsmTileProviderTest {
|
class OsmTileProviderTest {
|
||||||
// @get:Rule
|
// @get:Rule
|
||||||
// val rule = createComposeRule()
|
// val rule = createComposeRule()
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package center.sciprog.maps.compose
|
package center.sciprog.maps.compose
|
||||||
|
|
||||||
|
import androidx.compose.foundation.gestures.detectTapGestures
|
||||||
import androidx.compose.foundation.gestures.drag
|
import androidx.compose.foundation.gestures.drag
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.geometry.Offset
|
import androidx.compose.ui.geometry.Offset
|
@ -26,32 +26,9 @@ public val PointerEvent.position: Offset get() = firstChange.position
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Detects tap, double-tap, and long press gestures and calls [onClick], [onDoubleClick], and
|
* An alternative to [detectTapGestures] with reimplementation of internal logic
|
||||||
* [onLongClick], respectively, when detected. [onPress] is called when the press is detected
|
|
||||||
* and the [PressGestureScope.tryAwaitRelease] and [PressGestureScope.awaitRelease] can be
|
|
||||||
* used to detect when pointers have released or the gesture was canceled.
|
|
||||||
* The first pointer down and final pointer up are consumed, and in the
|
|
||||||
* case of long press, all changes after the long press is detected are consumed.
|
|
||||||
*
|
|
||||||
* Each function parameter receives an [Offset] representing the position relative to the containing
|
|
||||||
* element. The [Offset] can be outside the actual bounds of the element itself meaning the numbers
|
|
||||||
* can be negative or larger than the element bounds if the touch target is smaller than the
|
|
||||||
* [ViewConfiguration.minimumTouchTargetSize].
|
|
||||||
*
|
|
||||||
* When [onDoubleClick] is provided, the tap gesture is detected only after
|
|
||||||
* the [ViewConfiguration.doubleTapMinTimeMillis] has passed and [onDoubleClick] is called if the
|
|
||||||
* second tap is started before [ViewConfiguration.doubleTapTimeoutMillis]. If [onDoubleClick] is not
|
|
||||||
* provided, then [onClick] is called when the pointer up has been received.
|
|
||||||
*
|
|
||||||
* After the initial [onPress], if the pointer moves out of the input area, the position change
|
|
||||||
* is consumed, or another gesture consumes the down or up events, the gestures are considered
|
|
||||||
* canceled. That means [onDoubleClick], [onLongClick], and [onClick] will not be called after a
|
|
||||||
* gesture has been canceled.
|
|
||||||
*
|
|
||||||
* If the first down event is consumed somewhere else, the entire gesture will be skipped,
|
|
||||||
* including [onPress].
|
|
||||||
*/
|
*/
|
||||||
public suspend fun PointerInputScope.detectClicks(
|
internal suspend fun PointerInputScope.detectClicks(
|
||||||
onDoubleClick: (Density.(PointerEvent) -> Unit)? = null,
|
onDoubleClick: (Density.(PointerEvent) -> Unit)? = null,
|
||||||
onLongClick: (Density.(PointerEvent) -> Unit)? = null,
|
onLongClick: (Density.(PointerEvent) -> Unit)? = null,
|
||||||
onPress: suspend PressGestureScope.(event: PointerEvent) -> Unit = NoPressGesture,
|
onPress: suspend PressGestureScope.(event: PointerEvent) -> Unit = NoPressGesture,
|
@ -5,6 +5,8 @@ enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS")
|
|||||||
pluginManagement {
|
pluginManagement {
|
||||||
|
|
||||||
val toolsVersion: String by extra
|
val toolsVersion: String by extra
|
||||||
|
val composeVersion = extra["compose.version"] as String
|
||||||
|
val agpVersion = extra["agp.version"] as String
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
mavenLocal()
|
mavenLocal()
|
||||||
@ -18,11 +20,13 @@ pluginManagement {
|
|||||||
plugins {
|
plugins {
|
||||||
// id("com.android.application").version(extra["agp.version"] as String)
|
// id("com.android.application").version(extra["agp.version"] as String)
|
||||||
// id("com.android.library").version(extra["agp.version"] as String)
|
// id("com.android.library").version(extra["agp.version"] as String)
|
||||||
id("org.jetbrains.compose").version(extra["compose.version"] as String)
|
id("org.jetbrains.compose") version composeVersion
|
||||||
id("space.kscience.gradle.project") version toolsVersion
|
id("space.kscience.gradle.project") version toolsVersion
|
||||||
id("space.kscience.gradle.mpp") version toolsVersion
|
id("space.kscience.gradle.mpp") version toolsVersion
|
||||||
id("space.kscience.gradle.jvm") version toolsVersion
|
id("space.kscience.gradle.jvm") version toolsVersion
|
||||||
id("space.kscience.gradle.js") version toolsVersion
|
id("space.kscience.gradle.js") version toolsVersion
|
||||||
|
id("com.android.application") version agpVersion
|
||||||
|
id("com.android.library") version agpVersion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user