Skip to content

Commit b203d4a

Browse files
committed
fixed more bugs v2
1 parent 5832862 commit b203d4a

File tree

3 files changed

+23
-14
lines changed

3 files changed

+23
-14
lines changed

src/main/java/at/hannibal2/skyhanni/test/graph/GraphEditorInput.kt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,6 @@ object GraphEditorInput {
199199
private fun handleTextMode(): Boolean {
200200
if (!state.inTextMode) return false
201201
textBox.handle()
202-
state.activeNode?.name = textBox.finalText().ifEmpty { null }
203202
return true
204203
}
205204

@@ -209,7 +208,6 @@ object GraphEditorInput {
209208
val newText = textBox.finalText().ifEmpty { null }
210209
val activeNode = state.activeNode
211210

212-
// Check if name got changed
213211
if (activeNode != null && activeNode.name != newText) {
214212
GraphEditorHistory.save("renamed node")
215213
activeNode.name = newText

src/main/java/at/hannibal2/skyhanni/test/graph/GraphEditorRenderer.kt

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -118,18 +118,25 @@ object GraphEditorRenderer {
118118
inverseAlphaScale = true,
119119
)
120120

121-
val nodeName = node.name ?: return
122121
val showTextAlways = seeThroughBlocks || node.distanceSqToPlayer() < 100
123-
this.drawDynamicText(
124-
node.position,
125-
nodeName,
126-
0.8,
127-
seeThroughBlocks = showTextAlways,
128-
smallestDistanceVew = 12.0,
129-
ignoreY = true,
130-
yOff = -15f,
131-
maxDistance = 80,
132-
)
122+
123+
val nodeName = if (inTextMode && node == activeNode) {
124+
textBox.finalText().ifEmpty { null }
125+
} else {
126+
node.name
127+
}
128+
if (nodeName != null) {
129+
this.drawDynamicText(
130+
node.position,
131+
nodeName,
132+
0.8,
133+
seeThroughBlocks = showTextAlways,
134+
smallestDistanceVew = 12.0,
135+
ignoreY = true,
136+
yOff = -15f,
137+
maxDistance = 80,
138+
)
139+
}
133140

134141
val tags = node.tags
135142
if (tags.isEmpty()) return

src/main/java/at/hannibal2/skyhanni/test/graph/GraphNodeEditor.kt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,11 @@ object GraphNodeEditor {
202202
if (node.tags.isNotEmpty()) {
203203
if (!node.tags.any { it in tagsToShow }) continue
204204
}
205-
val name = node.name?.takeIf { it.isNotBlank() } ?: continue
205+
val name = if (state.inTextMode && node == state.activeNode) {
206+
state.textBox.finalText().takeIf { it.isNotBlank() }
207+
} else {
208+
node.name?.takeIf { it.isNotBlank() }
209+
} ?: continue
206210
val color = if (node == state.activeNode) "§a" else "§7"
207211
val distanceFormat = sqrt(distance).toInt().addSeparators()
208212
val tagText = node.tags.let { tags ->

0 commit comments

Comments
 (0)