Update rich text with Druid component and content adjust into root size

This commit is contained in:
Insality
2022-11-04 20:09:46 +02:00
parent fae7e4afa4
commit 66abd3bd31
7 changed files with 225 additions and 48 deletions

View File

@@ -84,8 +84,8 @@ nodes {
w: 1.0
}
scale {
x: 1.0
y: 1.0
x: 1.3
y: 1.3
z: 1.0
w: 1.0
}
@@ -126,8 +126,8 @@ nodes {
w: 1.0
}
scale {
x: 1.0
y: 1.0
x: 1.2
y: 1.2
z: 1.0
w: 1.0
}
@@ -149,7 +149,7 @@ nodes {
id: "rich_text/root"
xanchor: XANCHOR_NONE
yanchor: YANCHOR_NONE
pivot: PIVOT_E
pivot: PIVOT_N
adjust_mode: ADJUST_MODE_FIT
parent: "rich_text"
layer: ""
@@ -164,6 +164,7 @@ nodes {
clipping_visible: true
clipping_inverted: false
alpha: 1.0
overridden_fields: 3
overridden_fields: 5
overridden_fields: 14
overridden_fields: 46
@@ -187,8 +188,8 @@ nodes {
w: 1.0
}
scale {
x: 1.0
y: 1.0
x: 0.8
y: 0.8
z: 1.0
w: 1.0
}
@@ -225,13 +226,15 @@ nodes {
w: 1.0
}
adjust_mode: ADJUST_MODE_FIT
line_break: false
line_break: true
parent: "rich_text/root"
layer: ""
inherit_alpha: true
alpha: 1.0
outline_alpha: 1.0
shadow_alpha: 0.0
overridden_fields: 3
overridden_fields: 18
template_node_child: true
text_leading: 1.0
text_tracking: 0.0
@@ -297,6 +300,64 @@ nodes {
enabled: true
visible: true
}
nodes {
position {
x: 0.0
y: 0.0
z: 0.0
w: 1.0
}
rotation {
x: 0.0
y: 0.0
z: 0.0
w: 1.0
}
scale {
x: 1.0
y: 1.0
z: 1.0
w: 1.0
}
size {
x: 150.0
y: 4.0
z: 0.0
w: 1.0
}
color {
x: 1.0
y: 1.0
z: 1.0
w: 1.0
}
type: TYPE_BOX
blend_mode: BLEND_MODE_ALPHA
texture: ""
id: "middle_line"
xanchor: XANCHOR_NONE
yanchor: YANCHOR_NONE
pivot: PIVOT_CENTER
adjust_mode: ADJUST_MODE_FIT
parent: "root"
layer: ""
inherit_alpha: true
slice9 {
x: 0.0
y: 0.0
z: 0.0
w: 0.0
}
clipping_mode: CLIPPING_MODE_NONE
clipping_visible: true
clipping_inverted: false
alpha: 0.56
template_node_child: false
size_mode: SIZE_MODE_MANUAL
custom_type: 0
enabled: true
visible: true
}
layers {
name: "image"
}

View File

@@ -0,0 +1,34 @@
local druid = require("druid.druid")
local RichText = require("druid.custom.rich_text.rich_text")
function init(self)
self.druid = druid.new(self)
self.rich_text = self.druid:new(RichText, "rich_text")
-- self.rich_text:set_text("Lorem long text with differrent placeholder or just text without any sense here to check multiline without long words")
-- self.rich_text:set_text("Lorem long text with differrent placeholder or just text without any sense here to check multiline without long wordswordwordwrodwrodwrodswrodword he")
self.rich_text:set_text("Some text with image <img=logo,32/> in the middle")
self.rich_text:set_text("Some text with image <img=slider_move,32/> in the middle")
end
function final(self)
self.druid:final()
end
function update(self, dt)
self.druid:update(dt)
end
function on_message(self, message_id, message, sender)
self.druid:on_message(message_id, message, sender)
end
function on_input(self, action_id, action)
return self.druid:on_input(action_id, action)
end