Bug fixing

This commit is contained in:
Alexei Anoshenko 2024-02-27 17:08:05 +03:00
parent d07b24c953
commit 30c915d73b
3 changed files with 21 additions and 21 deletions

View File

@ -169,10 +169,10 @@ func (app *application) socketReader(bridge webBridge) {
session.handleAnswer(obj)
case "imageLoaded":
session.imageManager().imageLoaded(obj, session)
session.imageManager().imageLoaded(obj)
case "imageError":
session.imageManager().imageLoadError(obj, session)
session.imageManager().imageLoadError(obj)
default:
events <- obj
@ -295,7 +295,7 @@ func OpenBrowser(url string) bool {
case "linux":
for _, provider := range []string{"xdg-open", "x-www-browser", "www-browser"} {
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
}
}

View File

@ -83,7 +83,7 @@ func (manager *imageManager) loadImage(url string, onLoaded func(Image), session
return image
}
func (manager *imageManager) imageLoaded(obj DataObject, session Session) {
func (manager *imageManager) imageLoaded(obj DataObject) {
if manager.images == nil {
manager.images = make(map[string]*imageData)
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 {
manager.images = make(map[string]*imageData)
return

View File

@ -589,7 +589,7 @@ func (listView *listViewData) getItemFrames() []Frame {
return listView.itemFrame
}
func (listView *listViewData) itemAlign(self View, buffer *strings.Builder) {
func (listView *listViewData) itemAlign(buffer *strings.Builder) {
values := enumProperties[ItemHorizontalAlign].cssValues
if hAlign := GetListItemHorizontalAlign(listView); hAlign >= 0 && hAlign < len(values) {
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 {
buffer.WriteString(` min-width: `)
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()
contentBuilder := allocStringBuilder()
defer freeStringBuilder(contentBuilder)
contentBuilder.WriteString(`<div style="display: grid;`)
listView.itemAlign(self, contentBuilder)
listView.itemAlign(contentBuilder)
onDivBuilder := allocStringBuilder()
defer freeStringBuilder(onDivBuilder)
@ -681,7 +681,7 @@ func (listView *listViewData) getDivs(self View, checkbox, hCheckboxAlign, vChec
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()
defer freeStringBuilder(itemStyleBuilder)
@ -760,15 +760,15 @@ func (listView *listViewData) currentInactiveStyle() string {
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()
listViewID := listView.htmlID()
hCheckboxAlign := GetListViewCheckboxHorizontalAlign(listView)
vCheckboxAlign := GetListViewCheckboxVerticalAlign(listView)
itemDiv := listView.checkboxItemDiv(self, checkbox, hCheckboxAlign, vCheckboxAlign)
onDiv, offDiv, contentDiv := listView.getDivs(self, checkbox, hCheckboxAlign, vCheckboxAlign)
itemDiv := listView.checkboxItemDiv(checkbox, hCheckboxAlign, vCheckboxAlign)
onDiv, offDiv, contentDiv := listView.getDivs(checkbox, hCheckboxAlign, vCheckboxAlign)
current := GetCurrent(listView)
checkedItems := GetListViewCheckedItems(listView)
@ -784,7 +784,7 @@ func (listView *listViewData) checkboxSubviews(self View, buffer *strings.Builde
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;`)
listView.itemSize(self, buffer)
listView.itemSize(buffer)
if !listView.adapter.IsListItemEnabled(i) {
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()
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;`)
listView.itemAlign(self, itemStyleBuilder)
listView.itemSize(self, itemStyleBuilder)
listView.itemAlign(itemStyleBuilder)
listView.itemSize(itemStyleBuilder)
itemStyleBuilder.WriteString(`" onclick="listItemClickEvent(this, event)"`)
itemStyle := itemStyleBuilder.String()
@ -865,12 +865,12 @@ func (listView *listViewData) updateCheckboxItem(index int, checked bool) {
checkbox := GetListViewCheckbox(listView)
hCheckboxAlign := GetListViewCheckboxHorizontalAlign(listView)
vCheckboxAlign := GetListViewCheckboxVerticalAlign(listView)
onDiv, offDiv, contentDiv := listView.getDivs(listView, checkbox, hCheckboxAlign, vCheckboxAlign)
onDiv, offDiv, contentDiv := listView.getDivs(checkbox, hCheckboxAlign, vCheckboxAlign)
buffer := allocStringBuilder()
defer freeStringBuilder(buffer)
buffer.WriteString(listView.checkboxItemDiv(listView, checkbox, hCheckboxAlign, vCheckboxAlign))
buffer.WriteString(listView.checkboxItemDiv(checkbox, hCheckboxAlign, vCheckboxAlign))
if checked {
buffer.WriteString(onDiv)
} else {
@ -1061,9 +1061,9 @@ func (listView *listViewData) htmlSubviews(self View, buffer *strings.Builder) {
checkbox := GetListViewCheckbox(listView)
if checkbox == NoneCheckbox {
listView.noneCheckboxSubviews(self, buffer)
listView.noneCheckboxSubviews(buffer)
} else {
listView.checkboxSubviews(self, buffer, checkbox)
listView.checkboxSubviews(buffer, checkbox)
}
buffer.WriteString(`</div>`)