forked from mbk-lab/rui_orig
Bug fixing
This commit is contained in:
parent
d07b24c953
commit
30c915d73b
|
@ -169,10 +169,10 @@ func (app *application) socketReader(bridge webBridge) {
|
||||||
session.handleAnswer(obj)
|
session.handleAnswer(obj)
|
||||||
|
|
||||||
case "imageLoaded":
|
case "imageLoaded":
|
||||||
session.imageManager().imageLoaded(obj, session)
|
session.imageManager().imageLoaded(obj)
|
||||||
|
|
||||||
case "imageError":
|
case "imageError":
|
||||||
session.imageManager().imageLoadError(obj, session)
|
session.imageManager().imageLoadError(obj)
|
||||||
|
|
||||||
default:
|
default:
|
||||||
events <- obj
|
events <- obj
|
||||||
|
@ -295,7 +295,7 @@ func OpenBrowser(url string) bool {
|
||||||
case "linux":
|
case "linux":
|
||||||
for _, provider := range []string{"xdg-open", "x-www-browser", "www-browser"} {
|
for _, provider := range []string{"xdg-open", "x-www-browser", "www-browser"} {
|
||||||
if _, err = exec.LookPath(provider); err == nil {
|
if _, err = exec.LookPath(provider); err == nil {
|
||||||
if exec.Command(provider, url).Start(); err == nil {
|
if err = exec.Command(provider, url).Start(); err == nil {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
4
image.go
4
image.go
|
@ -83,7 +83,7 @@ func (manager *imageManager) loadImage(url string, onLoaded func(Image), session
|
||||||
return image
|
return image
|
||||||
}
|
}
|
||||||
|
|
||||||
func (manager *imageManager) imageLoaded(obj DataObject, session Session) {
|
func (manager *imageManager) imageLoaded(obj DataObject) {
|
||||||
if manager.images == nil {
|
if manager.images == nil {
|
||||||
manager.images = make(map[string]*imageData)
|
manager.images = make(map[string]*imageData)
|
||||||
return
|
return
|
||||||
|
@ -109,7 +109,7 @@ func (manager *imageManager) imageLoaded(obj DataObject, session Session) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (manager *imageManager) imageLoadError(obj DataObject, session Session) {
|
func (manager *imageManager) imageLoadError(obj DataObject) {
|
||||||
if manager.images == nil {
|
if manager.images == nil {
|
||||||
manager.images = make(map[string]*imageData)
|
manager.images = make(map[string]*imageData)
|
||||||
return
|
return
|
||||||
|
|
32
listView.go
32
listView.go
|
@ -589,7 +589,7 @@ func (listView *listViewData) getItemFrames() []Frame {
|
||||||
return listView.itemFrame
|
return listView.itemFrame
|
||||||
}
|
}
|
||||||
|
|
||||||
func (listView *listViewData) itemAlign(self View, buffer *strings.Builder) {
|
func (listView *listViewData) itemAlign(buffer *strings.Builder) {
|
||||||
values := enumProperties[ItemHorizontalAlign].cssValues
|
values := enumProperties[ItemHorizontalAlign].cssValues
|
||||||
if hAlign := GetListItemHorizontalAlign(listView); hAlign >= 0 && hAlign < len(values) {
|
if hAlign := GetListItemHorizontalAlign(listView); hAlign >= 0 && hAlign < len(values) {
|
||||||
buffer.WriteString(" justify-items: ")
|
buffer.WriteString(" justify-items: ")
|
||||||
|
@ -605,7 +605,7 @@ func (listView *listViewData) itemAlign(self View, buffer *strings.Builder) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (listView *listViewData) itemSize(self View, buffer *strings.Builder) {
|
func (listView *listViewData) itemSize(buffer *strings.Builder) {
|
||||||
if itemWidth := GetListItemWidth(listView); itemWidth.Type != Auto {
|
if itemWidth := GetListItemWidth(listView); itemWidth.Type != Auto {
|
||||||
buffer.WriteString(` min-width: `)
|
buffer.WriteString(` min-width: `)
|
||||||
buffer.WriteString(itemWidth.cssString("", listView.Session()))
|
buffer.WriteString(itemWidth.cssString("", listView.Session()))
|
||||||
|
@ -619,14 +619,14 @@ func (listView *listViewData) itemSize(self View, buffer *strings.Builder) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (listView *listViewData) getDivs(self View, checkbox, hCheckboxAlign, vCheckboxAlign int) (string, string, string) {
|
func (listView *listViewData) getDivs(checkbox, hCheckboxAlign, vCheckboxAlign int) (string, string, string) {
|
||||||
session := listView.Session()
|
session := listView.Session()
|
||||||
|
|
||||||
contentBuilder := allocStringBuilder()
|
contentBuilder := allocStringBuilder()
|
||||||
defer freeStringBuilder(contentBuilder)
|
defer freeStringBuilder(contentBuilder)
|
||||||
|
|
||||||
contentBuilder.WriteString(`<div style="display: grid;`)
|
contentBuilder.WriteString(`<div style="display: grid;`)
|
||||||
listView.itemAlign(self, contentBuilder)
|
listView.itemAlign(contentBuilder)
|
||||||
|
|
||||||
onDivBuilder := allocStringBuilder()
|
onDivBuilder := allocStringBuilder()
|
||||||
defer freeStringBuilder(onDivBuilder)
|
defer freeStringBuilder(onDivBuilder)
|
||||||
|
@ -681,7 +681,7 @@ func (listView *listViewData) getDivs(self View, checkbox, hCheckboxAlign, vChec
|
||||||
return onDivBuilder.String(), offDivBuilder.String(), contentBuilder.String()
|
return onDivBuilder.String(), offDivBuilder.String(), contentBuilder.String()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (listView *listViewData) checkboxItemDiv(self View, checkbox, hCheckboxAlign, vCheckboxAlign int) string {
|
func (listView *listViewData) checkboxItemDiv(checkbox, hCheckboxAlign, vCheckboxAlign int) string {
|
||||||
itemStyleBuilder := allocStringBuilder()
|
itemStyleBuilder := allocStringBuilder()
|
||||||
defer freeStringBuilder(itemStyleBuilder)
|
defer freeStringBuilder(itemStyleBuilder)
|
||||||
|
|
||||||
|
@ -760,15 +760,15 @@ func (listView *listViewData) currentInactiveStyle() string {
|
||||||
return listView.itemStyle(CurrentInactiveStyle, "ruiListItemSelected")
|
return listView.itemStyle(CurrentInactiveStyle, "ruiListItemSelected")
|
||||||
}
|
}
|
||||||
|
|
||||||
func (listView *listViewData) checkboxSubviews(self View, buffer *strings.Builder, checkbox int) {
|
func (listView *listViewData) checkboxSubviews(buffer *strings.Builder, checkbox int) {
|
||||||
count := listView.adapter.ListSize()
|
count := listView.adapter.ListSize()
|
||||||
listViewID := listView.htmlID()
|
listViewID := listView.htmlID()
|
||||||
|
|
||||||
hCheckboxAlign := GetListViewCheckboxHorizontalAlign(listView)
|
hCheckboxAlign := GetListViewCheckboxHorizontalAlign(listView)
|
||||||
vCheckboxAlign := GetListViewCheckboxVerticalAlign(listView)
|
vCheckboxAlign := GetListViewCheckboxVerticalAlign(listView)
|
||||||
|
|
||||||
itemDiv := listView.checkboxItemDiv(self, checkbox, hCheckboxAlign, vCheckboxAlign)
|
itemDiv := listView.checkboxItemDiv(checkbox, hCheckboxAlign, vCheckboxAlign)
|
||||||
onDiv, offDiv, contentDiv := listView.getDivs(self, checkbox, hCheckboxAlign, vCheckboxAlign)
|
onDiv, offDiv, contentDiv := listView.getDivs(checkbox, hCheckboxAlign, vCheckboxAlign)
|
||||||
|
|
||||||
current := GetCurrent(listView)
|
current := GetCurrent(listView)
|
||||||
checkedItems := GetListViewCheckedItems(listView)
|
checkedItems := GetListViewCheckedItems(listView)
|
||||||
|
@ -784,7 +784,7 @@ func (listView *listViewData) checkboxSubviews(self View, buffer *strings.Builde
|
||||||
buffer.WriteString(listView.currentInactiveStyle())
|
buffer.WriteString(listView.currentInactiveStyle())
|
||||||
}
|
}
|
||||||
buffer.WriteString(`" onclick="listItemClickEvent(this, event)" data-left="0" data-top="0" data-width="0" data-height="0" style="display: grid; justify-items: stretch; align-items: stretch;`)
|
buffer.WriteString(`" onclick="listItemClickEvent(this, event)" data-left="0" data-top="0" data-width="0" data-height="0" style="display: grid; justify-items: stretch; align-items: stretch;`)
|
||||||
listView.itemSize(self, buffer)
|
listView.itemSize(buffer)
|
||||||
if !listView.adapter.IsListItemEnabled(i) {
|
if !listView.adapter.IsListItemEnabled(i) {
|
||||||
buffer.WriteString(`" data-disabled="1`)
|
buffer.WriteString(`" data-disabled="1`)
|
||||||
}
|
}
|
||||||
|
@ -815,7 +815,7 @@ func (listView *listViewData) checkboxSubviews(self View, buffer *strings.Builde
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (listView *listViewData) noneCheckboxSubviews(self View, buffer *strings.Builder) {
|
func (listView *listViewData) noneCheckboxSubviews(buffer *strings.Builder) {
|
||||||
count := listView.adapter.ListSize()
|
count := listView.adapter.ListSize()
|
||||||
listViewID := listView.htmlID()
|
listViewID := listView.htmlID()
|
||||||
|
|
||||||
|
@ -824,8 +824,8 @@ func (listView *listViewData) noneCheckboxSubviews(self View, buffer *strings.Bu
|
||||||
|
|
||||||
itemStyleBuilder.WriteString(`data-left="0" data-top="0" data-width="0" data-height="0" style="max-width: 100%; max-height: 100%; display: grid;`)
|
itemStyleBuilder.WriteString(`data-left="0" data-top="0" data-width="0" data-height="0" style="max-width: 100%; max-height: 100%; display: grid;`)
|
||||||
|
|
||||||
listView.itemAlign(self, itemStyleBuilder)
|
listView.itemAlign(itemStyleBuilder)
|
||||||
listView.itemSize(self, itemStyleBuilder)
|
listView.itemSize(itemStyleBuilder)
|
||||||
|
|
||||||
itemStyleBuilder.WriteString(`" onclick="listItemClickEvent(this, event)"`)
|
itemStyleBuilder.WriteString(`" onclick="listItemClickEvent(this, event)"`)
|
||||||
itemStyle := itemStyleBuilder.String()
|
itemStyle := itemStyleBuilder.String()
|
||||||
|
@ -865,12 +865,12 @@ func (listView *listViewData) updateCheckboxItem(index int, checked bool) {
|
||||||
checkbox := GetListViewCheckbox(listView)
|
checkbox := GetListViewCheckbox(listView)
|
||||||
hCheckboxAlign := GetListViewCheckboxHorizontalAlign(listView)
|
hCheckboxAlign := GetListViewCheckboxHorizontalAlign(listView)
|
||||||
vCheckboxAlign := GetListViewCheckboxVerticalAlign(listView)
|
vCheckboxAlign := GetListViewCheckboxVerticalAlign(listView)
|
||||||
onDiv, offDiv, contentDiv := listView.getDivs(listView, checkbox, hCheckboxAlign, vCheckboxAlign)
|
onDiv, offDiv, contentDiv := listView.getDivs(checkbox, hCheckboxAlign, vCheckboxAlign)
|
||||||
|
|
||||||
buffer := allocStringBuilder()
|
buffer := allocStringBuilder()
|
||||||
defer freeStringBuilder(buffer)
|
defer freeStringBuilder(buffer)
|
||||||
|
|
||||||
buffer.WriteString(listView.checkboxItemDiv(listView, checkbox, hCheckboxAlign, vCheckboxAlign))
|
buffer.WriteString(listView.checkboxItemDiv(checkbox, hCheckboxAlign, vCheckboxAlign))
|
||||||
if checked {
|
if checked {
|
||||||
buffer.WriteString(onDiv)
|
buffer.WriteString(onDiv)
|
||||||
} else {
|
} else {
|
||||||
|
@ -1061,9 +1061,9 @@ func (listView *listViewData) htmlSubviews(self View, buffer *strings.Builder) {
|
||||||
|
|
||||||
checkbox := GetListViewCheckbox(listView)
|
checkbox := GetListViewCheckbox(listView)
|
||||||
if checkbox == NoneCheckbox {
|
if checkbox == NoneCheckbox {
|
||||||
listView.noneCheckboxSubviews(self, buffer)
|
listView.noneCheckboxSubviews(buffer)
|
||||||
} else {
|
} else {
|
||||||
listView.checkboxSubviews(self, buffer, checkbox)
|
listView.checkboxSubviews(buffer, checkbox)
|
||||||
}
|
}
|
||||||
|
|
||||||
buffer.WriteString(`</div>`)
|
buffer.WriteString(`</div>`)
|
||||||
|
|
Loading…
Reference in New Issue