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:
@@ -2,7 +2,7 @@ project.extra.set("devMode", true)
|
|||||||
project.extra.set("enabledSourceMaps", true)
|
project.extra.set("enabledSourceMaps", true)
|
||||||
|
|
||||||
group = "nl.astraeus"
|
group = "nl.astraeus"
|
||||||
version = "2.2.2"
|
version = "2.2.3"
|
||||||
|
|
||||||
allprojects {
|
allprojects {
|
||||||
repositories {
|
repositories {
|
||||||
|
|||||||
@@ -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.ExperimentalKotlinGradlePluginApi
|
||||||
import org.jetbrains.kotlin.gradle.dsl.JsSourceMapEmbedMode
|
import org.jetbrains.kotlin.gradle.dsl.JsSourceMapEmbedMode
|
||||||
|
import org.jetbrains.kotlin.gradle.targets.js.dsl.ExperimentalDistributionDsl
|
||||||
|
|
||||||
buildscript {
|
buildscript {
|
||||||
apply(from = "../common.gradle.kts")
|
apply(from = "../common.gradle.kts")
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
apply(from = "../settings.common.gradle.kts")
|
|
||||||
@@ -2,33 +2,11 @@
|
|||||||
|
|
||||||
package nl.astraeus.vst.ui.view
|
package nl.astraeus.vst.ui.view
|
||||||
|
|
||||||
import kotlinx.html.InputType
|
import kotlinx.html.*
|
||||||
import kotlinx.html.div
|
|
||||||
import kotlinx.html.h1
|
|
||||||
import kotlinx.html.hr
|
|
||||||
import kotlinx.html.input
|
|
||||||
import kotlinx.html.js.onChangeFunction
|
import kotlinx.html.js.onChangeFunction
|
||||||
import kotlinx.html.js.onClickFunction
|
import kotlinx.html.js.onClickFunction
|
||||||
import kotlinx.html.option
|
|
||||||
import kotlinx.html.org.w3c.dom.events.Event
|
import kotlinx.html.org.w3c.dom.events.Event
|
||||||
import kotlinx.html.select
|
import nl.astraeus.css.properties.*
|
||||||
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.style.Style
|
import nl.astraeus.css.style.Style
|
||||||
import nl.astraeus.css.style.cls
|
import nl.astraeus.css.style.cls
|
||||||
import nl.astraeus.komp.HtmlBuilder
|
import nl.astraeus.komp.HtmlBuilder
|
||||||
@@ -67,6 +45,7 @@ class MainView : Komponent() {
|
|||||||
|
|
||||||
override fun HtmlBuilder.render() {
|
override fun HtmlBuilder.render() {
|
||||||
div(MainDivCss.name) {
|
div(MainDivCss.name) {
|
||||||
|
style = "transform: scale(0.5);"
|
||||||
if (!started) {
|
if (!started) {
|
||||||
div(StartSplashCss.name) {
|
div(StartSplashCss.name) {
|
||||||
div(StartBoxCss.name) {
|
div(StartBoxCss.name) {
|
||||||
|
|||||||
@@ -66,13 +66,7 @@ kotlin {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mavenPublishing {
|
publishing {
|
||||||
coordinates(group.toString(), name, version.toString())
|
|
||||||
|
|
||||||
publishToMavenCentral(SonatypeHost.CENTRAL_PORTAL, automaticRelease = true)
|
|
||||||
|
|
||||||
configure(KotlinMultiplatform())
|
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
maven {
|
maven {
|
||||||
name = "gitea"
|
name = "gitea"
|
||||||
@@ -88,6 +82,14 @@ mavenPublishing {
|
|||||||
}
|
}
|
||||||
mavenLocal()
|
mavenLocal()
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
mavenPublishing {
|
||||||
|
coordinates(group.toString(), name, version.toString())
|
||||||
|
|
||||||
|
publishToMavenCentral(SonatypeHost.CENTRAL_PORTAL, automaticRelease = true)
|
||||||
|
|
||||||
|
configure(KotlinMultiplatform())
|
||||||
|
|
||||||
signAllPublications()
|
signAllPublications()
|
||||||
|
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
apply(from = "../settings.common.gradle.kts")
|
|
||||||
@@ -54,6 +54,7 @@ open class BaseKnobComponent(
|
|||||||
val width: Int,
|
val width: Int,
|
||||||
val height: Int,
|
val height: Int,
|
||||||
val pixelStep: Double,
|
val pixelStep: Double,
|
||||||
|
val scale: Double = 1.0,
|
||||||
val valueToActual: (Double) -> Double,
|
val valueToActual: (Double) -> Double,
|
||||||
val actualToValue: (Double) -> Double,
|
val actualToValue: (Double) -> Double,
|
||||||
val renderer: (Double) -> String,
|
val renderer: (Double) -> String,
|
||||||
@@ -250,11 +251,13 @@ open class BaseKnobComponent(
|
|||||||
) {
|
) {
|
||||||
val target = knobElement as? HTMLElement ?: error("Not in an HTMLElement?")
|
val target = knobElement as? HTMLElement ?: error("Not in an HTMLElement?")
|
||||||
val rect = target.getBoundingClientRect();
|
val rect = target.getBoundingClientRect();
|
||||||
val mouseX = it.clientX - rect.left;
|
val mouseX = it.clientX - rect.left
|
||||||
val mouseY = it.clientY - rect.top;
|
val mouseY = it.clientY - rect.top
|
||||||
|
|
||||||
val deltaX = mouseX - getMiddleX()
|
console.log("Mouse vs middle: ", it, rect)
|
||||||
val deltaY = mouseY - getMiddleY()
|
|
||||||
|
val deltaX = mouseX - rect.width / 2.0
|
||||||
|
val deltaY = mouseY - rect.height / 2.0
|
||||||
|
|
||||||
var angle = atan2(deltaX, deltaY)
|
var angle = atan2(deltaX, deltaY)
|
||||||
|
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ class ExpKnobComponent(
|
|||||||
step: Double = 0.1,
|
step: Double = 0.1,
|
||||||
width: Int = 50,
|
width: Int = 50,
|
||||||
height: Int = 60,
|
height: Int = 60,
|
||||||
|
scale: Double = 1.0,
|
||||||
renderer: (Double) -> String = { nv -> formatDouble(nv, 3) },
|
renderer: (Double) -> String = { nv -> formatDouble(nv, 3) },
|
||||||
callback: (Double) -> Unit = {}
|
callback: (Double) -> Unit = {}
|
||||||
) : BaseKnobComponent(
|
) : BaseKnobComponent(
|
||||||
@@ -30,6 +31,7 @@ class ExpKnobComponent(
|
|||||||
width,
|
width,
|
||||||
height,
|
height,
|
||||||
0.005,
|
0.005,
|
||||||
|
scale,
|
||||||
{ log10(it) },
|
{ log10(it) },
|
||||||
{ 10.0.pow(it) },
|
{ 10.0.pow(it) },
|
||||||
renderer,
|
renderer,
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ class KnobComponent(
|
|||||||
pixelStep: Double = step / 25.0,
|
pixelStep: Double = step / 25.0,
|
||||||
width: Int = 50,
|
width: Int = 50,
|
||||||
height: Int = 60,
|
height: Int = 60,
|
||||||
|
scale: Double = 1.0,
|
||||||
renderer: (Double) -> String = { nv -> formatDouble(nv, 2) },
|
renderer: (Double) -> String = { nv -> formatDouble(nv, 2) },
|
||||||
callback: (Double) -> Unit = {}
|
callback: (Double) -> Unit = {}
|
||||||
) : BaseKnobComponent(
|
) : BaseKnobComponent(
|
||||||
@@ -29,6 +30,7 @@ class KnobComponent(
|
|||||||
width,
|
width,
|
||||||
height,
|
height,
|
||||||
pixelStep,
|
pixelStep,
|
||||||
|
scale,
|
||||||
{ it },
|
{ it },
|
||||||
{ it },
|
{ it },
|
||||||
renderer,
|
renderer,
|
||||||
|
|||||||
Reference in New Issue
Block a user