Refactor test-app and vst-ui-base: streamline build scripts, add scale option to KnobComponent hierarchy, fix mouse handling logic, update publishing configuration, and increment version to 2.2.3.

This commit is contained in:
2026-02-15 11:32:35 +01:00
parent 448cf09ff1
commit d5a377e974
9 changed files with 26 additions and 39 deletions

View File

@@ -2,7 +2,7 @@ project.extra.set("devMode", true)
project.extra.set("enabledSourceMaps", true)
group = "nl.astraeus"
version = "2.2.2"
version = "2.2.3"
allprojects {
repositories {

View File

@@ -1,7 +1,8 @@
@file:OptIn(ExperimentalKotlinGradlePluginApi::class)
@file:OptIn(ExperimentalKotlinGradlePluginApi::class, ExperimentalDistributionDsl::class)
import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi
import org.jetbrains.kotlin.gradle.dsl.JsSourceMapEmbedMode
import org.jetbrains.kotlin.gradle.targets.js.dsl.ExperimentalDistributionDsl
buildscript {
apply(from = "../common.gradle.kts")

View File

@@ -1 +0,0 @@
apply(from = "../settings.common.gradle.kts")

View File

@@ -2,33 +2,11 @@
package nl.astraeus.vst.ui.view
import kotlinx.html.InputType
import kotlinx.html.div
import kotlinx.html.h1
import kotlinx.html.hr
import kotlinx.html.input
import kotlinx.html.*
import kotlinx.html.js.onChangeFunction
import kotlinx.html.js.onClickFunction
import kotlinx.html.option
import kotlinx.html.org.w3c.dom.events.Event
import kotlinx.html.select
import kotlinx.html.span
import kotlinx.html.style
import nl.astraeus.css.properties.AlignItems
import nl.astraeus.css.properties.BoxSizing
import nl.astraeus.css.properties.Display
import nl.astraeus.css.properties.FlexDirection
import nl.astraeus.css.properties.FontWeight
import nl.astraeus.css.properties.JustifyContent
import nl.astraeus.css.properties.Position
import nl.astraeus.css.properties.Transform
import nl.astraeus.css.properties.em
import nl.astraeus.css.properties.hsla
import nl.astraeus.css.properties.prc
import nl.astraeus.css.properties.px
import nl.astraeus.css.properties.rem
import nl.astraeus.css.properties.vh
import nl.astraeus.css.properties.vw
import nl.astraeus.css.properties.*
import nl.astraeus.css.style.Style
import nl.astraeus.css.style.cls
import nl.astraeus.komp.HtmlBuilder
@@ -67,6 +45,7 @@ class MainView : Komponent() {
override fun HtmlBuilder.render() {
div(MainDivCss.name) {
style = "transform: scale(0.5);"
if (!started) {
div(StartSplashCss.name) {
div(StartBoxCss.name) {

View File

@@ -66,13 +66,7 @@ kotlin {
}
}
mavenPublishing {
coordinates(group.toString(), name, version.toString())
publishToMavenCentral(SonatypeHost.CENTRAL_PORTAL, automaticRelease = true)
configure(KotlinMultiplatform())
publishing {
repositories {
maven {
name = "gitea"
@@ -88,6 +82,14 @@ mavenPublishing {
}
mavenLocal()
}
}
mavenPublishing {
coordinates(group.toString(), name, version.toString())
publishToMavenCentral(SonatypeHost.CENTRAL_PORTAL, automaticRelease = true)
configure(KotlinMultiplatform())
signAllPublications()

View File

@@ -1 +0,0 @@
apply(from = "../settings.common.gradle.kts")

View File

@@ -54,6 +54,7 @@ open class BaseKnobComponent(
val width: Int,
val height: Int,
val pixelStep: Double,
val scale: Double = 1.0,
val valueToActual: (Double) -> Double,
val actualToValue: (Double) -> Double,
val renderer: (Double) -> String,
@@ -250,11 +251,13 @@ open class BaseKnobComponent(
) {
val target = knobElement as? HTMLElement ?: error("Not in an HTMLElement?")
val rect = target.getBoundingClientRect();
val mouseX = it.clientX - rect.left;
val mouseY = it.clientY - rect.top;
val mouseX = it.clientX - rect.left
val mouseY = it.clientY - rect.top
val deltaX = mouseX - getMiddleX()
val deltaY = mouseY - getMiddleY()
console.log("Mouse vs middle: ", it, rect)
val deltaX = mouseX - rect.width / 2.0
val deltaY = mouseY - rect.height / 2.0
var angle = atan2(deltaX, deltaY)

View File

@@ -18,6 +18,7 @@ class ExpKnobComponent(
step: Double = 0.1,
width: Int = 50,
height: Int = 60,
scale: Double = 1.0,
renderer: (Double) -> String = { nv -> formatDouble(nv, 3) },
callback: (Double) -> Unit = {}
) : BaseKnobComponent(
@@ -30,6 +31,7 @@ class ExpKnobComponent(
width,
height,
0.005,
scale,
{ log10(it) },
{ 10.0.pow(it) },
renderer,

View File

@@ -17,6 +17,7 @@ class KnobComponent(
pixelStep: Double = step / 25.0,
width: Int = 50,
height: Int = 60,
scale: Double = 1.0,
renderer: (Double) -> String = { nv -> formatDouble(nv, 2) },
callback: (Double) -> Unit = {}
) : BaseKnobComponent(
@@ -29,6 +30,7 @@ class KnobComponent(
width,
height,
pixelStep,
scale,
{ it },
{ it },
renderer,