mirror of
https://github.com/barsdeveloper/ueblueprint.git
synced 2026-02-27 02:34:45 +08:00
Minor fixes
This commit is contained in:
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user