forked from mbk-lab/rui_orig
2
0
Fork 0

Added AllImageResources() & bug fixing

This commit is contained in:
Alexei Anoshenko 2022-04-21 18:22:17 +03:00
parent 47ca08717d
commit 50cbb10bf6
7 changed files with 26 additions and 14 deletions

View File

@ -2,7 +2,7 @@
* Added "user-data" property
* Added "focusable" property
* Added ReloadTableViewData function
* Added ReloadTableViewData, AllImageResources functions
# v0.5.0

View File

@ -15,11 +15,11 @@ div {
-ms-user-select: none;
user-select: none;
}
/*
div:focus {
outline: none;
}
*/
input {
margin: 2px;
padding: 1px;

View File

@ -1,13 +1,13 @@
theme {
colors = _{
ruiTextColor = #FF000000,
ruiDisabledTextColor = #FF202020,
ruiDisabledTextColor = #FF808080,
ruiBackgroundColor = #FFFFFFFF,
ruiButtonColor = #FFE0E0E0,
ruiButtonActiveColor = #FFC0C0C0,
ruiButtonTextColor = #FF000000,
ruiButtonDisabledColor = #FFE0E0E0,
ruiButtonDisabledTextColor = #FF202020,
ruiButtonDisabledTextColor = #FF808080,
ruiHighlightColor = #FF1A74E8,
ruiHighlightTextColor = #FFFFFFFF,
ruiSelectedColor = #FFE0E0E0,
@ -19,7 +19,7 @@ theme {
ruiTabBarBackgroundColor = #FFEEEEEE,
ruiTabColor = #FFD0D0D0,
ruiTabTextColor = #FF202020,
ruiTabTextColor = #FF808080,
ruiCurrentTabColor = #FFFFFFFF,
ruiCurrentTabTextColor = #FF000000,
},

View File

@ -489,21 +489,21 @@ func (edit *editViewData) htmlProperties(self View, buffer *strings.Builder) {
if hint := GetHint(edit, ""); hint != "" {
buffer.WriteString(` placeholder="`)
buffer.WriteString(hint)
buffer.WriteString(textToJS(hint))
buffer.WriteByte('"')
}
buffer.WriteString(` oninput="editViewInputEvent(this)"`)
if pattern := GetEditViewPattern(edit, ""); pattern != "" {
buffer.WriteString(` pattern="`)
buffer.WriteString(pattern)
buffer.WriteString(textToJS(pattern))
buffer.WriteByte('"')
}
if editType != MultiLineText {
if text := GetText(edit, ""); text != "" {
buffer.WriteString(` value="`)
buffer.WriteString(text)
buffer.WriteString(textToJS(text))
buffer.WriteByte('"')
}
}
@ -518,10 +518,7 @@ func (edit *editViewData) htmlDisabledProperties(self View, buffer *strings.Buil
func (edit *editViewData) htmlSubviews(self View, buffer *strings.Builder) {
if GetEditViewType(edit, "") == MultiLineText {
text := strings.ReplaceAll(GetText(edit, ""), `"`, `\"`)
text = strings.ReplaceAll(text, "\n", `\n`)
text = strings.ReplaceAll(text, "\r", `\r`)
buffer.WriteString(strings.ReplaceAll(text, `'`, `\'`))
buffer.WriteString(textToJS(GetText(edit, "")))
}
}

View File

@ -70,6 +70,7 @@ var intProperties = []string{
}
var floatProperties = map[string]struct{ min, max float64 }{
Opacity: {min: 0, max: 1},
ScaleX: {min: -math.MaxFloat64, max: math.MaxFloat64},
ScaleY: {min: -math.MaxFloat64, max: math.MaxFloat64},
ScaleZ: {min: -math.MaxFloat64, max: math.MaxFloat64},

View File

@ -416,3 +416,11 @@ func AllRawResources() []string {
return result
}
func AllImageResources() []string {
result := make([]string, 0, len(resources.images))
for image := range resources.images {
result = append(result, image)
}
return result
}

View File

@ -561,6 +561,12 @@ func viewPropertyChanged(view *viewData, tag string) {
updateCSSProperty(htmlID, `animation-play-state`, `running`, session)
}
return
case ZIndex:
if i, ok := intProperty(view, ZIndex, session, 0); ok {
updateCSSProperty(htmlID, ZIndex, strconv.Itoa(i), session)
}
return
}
if cssTag, ok := sizeProperties[tag]; ok {
@ -589,7 +595,7 @@ func viewPropertyChanged(view *viewData, tag string) {
return
}
for _, floatTag := range []string{ScaleX, ScaleY, ScaleZ, RotateX, RotateY, RotateZ} {
for _, floatTag := range []string{Opacity, ScaleX, ScaleY, ScaleZ, RotateX, RotateY, RotateZ} {
if tag == floatTag {
if f, ok := floatProperty(view, floatTag, session, 0); ok {
updateCSSProperty(htmlID, floatTag, strconv.FormatFloat(f, 'g', -1, 64), session)