Minor fixes

This commit is contained in:
barsdeveloper
2022-04-25 18:51:23 +02:00
parent 4b563f023e
commit 1aa4ceb11c
8 changed files with 56 additions and 13 deletions

View File

@@ -169,6 +169,10 @@ export default class Utility {
* @param {String} value
*/
static formatStringName(value) {
return value.replaceAll(/\s+/g, " ").replaceAll(/(?<=[a-z])(?=[A-Z])|_/g, " ").trim()
return value
.trim()
.replaceAll(/\s+/g, " ") // Multiple spaces is just a single normal space
.replace(/^b/, "") // Remove leading b (for boolean values)
.replaceAll(/(?<=[a-z])(?=[A-Z])|_/g, " ") // Insert a space between
}
}

View File

@@ -72,6 +72,10 @@ export default class PinElement extends IElement {
* @returns {String}
*/
getPinDisplayName() {
if (this.entity.PinToolTip) {
const matchResult = this.entity.PinToolTip.match(/\s*(.+?(?=\\n)|.+\S)\s*/) // Match up until the first \n
return matchResult[1]
}
return Utility.formatStringName(this.entity.PinName)
}

View File

@@ -42,7 +42,7 @@ export default class NodeTemplate extends SelectableDraggableTemplate {
height="16"
fill="currentColor"
class="ueb-node-expansion-icon"
viewBox="4 2 24 24"
viewBox="4 4 24 24"
>
<path
fill-rule="evenodd"

View File

@@ -1,11 +1,21 @@
// @ts-check
import PinTemplate from "./PinTemplate"
import IInputPinTemplate from "./IInputPinTemplate"
/**
* @typedef {import("../element/PinElement").default} PinElement
*/
export default class RealPinTemplate extends PinTemplate {
export default class RealPinTemplate extends IInputPinTemplate {
/**
* @param {PinElement} pin
*/
acceptInput(pin) {
const value = parseFloat(this.getInput(pin))
pin.entity.DefaultValue = isNaN(value)
? pin.entity.AutogeneratedDefaultValue
: value.toString()
}
}