Bug fixing

This commit is contained in:
Alexei Anoshenko 2024-11-20 15:06:59 +02:00
parent 857ad69260
commit 7d4b90769f
9 changed files with 5 additions and 165 deletions

View File

@ -1,7 +1,7 @@
# v0.18.0 # v0.18.0
* Property name type changed to PropertyName. * Property name type changed to PropertyName.
* Transform interface renamed to TransformProperty. TransformTag constant renamed to Transform. * Transform interface renamed to TransformProperty. NewTransform function renamed to NewTransformProperty. TransformTag constant renamed to Transform.
* OriginX, OriginY, and OriginZ properties renamed to TransformOriginX, TransformOriginY, and TransformOriginZ * OriginX, OriginY, and OriginZ properties renamed to TransformOriginX, TransformOriginY, and TransformOriginZ
* GetOrigin function renamed to GetTransformOrigin * GetOrigin function renamed to GetTransformOrigin
* Added LineJoin type. Type of constants MiterJoin, RoundJoin, and BevelJoin changed to LineJoin. Type of Canvas.SetLineJoin function argument changed to LineJoin. * Added LineJoin type. Type of constants MiterJoin, RoundJoin, and BevelJoin changed to LineJoin. Type of Canvas.SetLineJoin function argument changed to LineJoin.

View File

@ -142,9 +142,9 @@ func (detailsView *detailsViewData) htmlSubviews(self View, buffer *strings.Buil
buffer.WriteString("</summary>") buffer.WriteString("</summary>")
case View: case View:
buffer.WriteString("<summary>") buffer.WriteString(`<summary><div style="display: inline-block;">`)
viewHTML(value, buffer) viewHTML(value, buffer)
buffer.WriteString("</summary>") buffer.WriteString("</div></summary>")
} }
} }

View File

@ -429,36 +429,6 @@ func (event *KeyEvent) init(data DataObject) {
event.MetaKey = getBool("metaKey") event.MetaKey = getBool("metaKey")
} }
/*
func setKeyListener(properties Properties, tag PropertyName, value any) bool {
if listeners, ok := valueToOneArgEventListeners[View, KeyEvent](value); ok {
if len(listeners) == 0 {
properties.setRaw(tag, nil)
} else {
properties.setRaw(tag, listeners)
}
return true
}
notCompatibleType(tag, value)
return false
}
func (view *viewData) removeKeyListener(tag PropertyName) {
delete(view.properties, tag)
if view.created {
switch tag {
case KeyDownEvent:
if !view.Focusable() {
view.session.removeProperty(view.htmlID(), "onkeydown")
}
case KeyUpEvent:
view.session.removeProperty(view.htmlID(), "onkeyup")
}
}
}
*/
func keyEventsHtml(view View, buffer *strings.Builder) { func keyEventsHtml(view View, buffer *strings.Builder) {
if len(getOneArgEventListeners[View, KeyEvent](view, nil, KeyDownEvent)) > 0 { if len(getOneArgEventListeners[View, KeyEvent](view, nil, KeyDownEvent)) > 0 {
buffer.WriteString(`onkeydown="keyDownEvent(this, event)" `) buffer.WriteString(`onkeydown="keyDownEvent(this, event)" `)

View File

@ -37,7 +37,6 @@ type ListLayout interface {
// UpdateContent updates child Views if the "content" property value is set to ListAdapter, // UpdateContent updates child Views if the "content" property value is set to ListAdapter,
// otherwise does nothing // otherwise does nothing
UpdateContent() UpdateContent()
setAdapter(ListAdapter)
} }
type listLayoutData struct { type listLayoutData struct {
@ -169,13 +168,6 @@ func (listLayout *listLayoutData) htmlSubviews(self View, buffer *strings.Builde
} }
} }
func (listLayout *listLayoutData) setAdapter(adapter ListAdapter) {
listLayout.adapter = adapter
if adapter != nil {
listLayout.createContent()
}
}
func (listLayout *listLayoutData) createContent() bool { func (listLayout *listLayoutData) createContent() bool {
if adapter := listLayout.adapter; adapter != nil { if adapter := listLayout.adapter; adapter != nil {
listLayout.views = []View{} listLayout.views = []View{}

View File

@ -228,50 +228,6 @@ type MouseEvent struct {
MetaKey bool MetaKey bool
} }
/*
func setMouseListener(properties Properties, tag PropertyName, value any) bool {
if listeners, ok := valueToOneArgEventListeners[View, MouseEvent](value); ok {
if len(listeners) == 0 {
properties.setRaw(tag, nil)
} else {
properties.setRaw(tag, listeners)
}
return true
}
notCompatibleType(tag, value)
return false
}
func (view *viewData) removeMouseListener(tag PropertyName) {
delete(view.properties, tag)
if view.created {
if js, ok := eventJsFunc[tag]; ok {
view.session.removeProperty(view.htmlID(), js.jsEvent)
}
}
}
func mouseEventsHtml(view View, buffer *strings.Builder, hasTooltip bool) {
for _, tag := range []PropertyName{ClickEvent, DoubleClickEvent, MouseDown, MouseUp, MouseMove, MouseOut, MouseOver, ContextMenuEvent} {
if value := view.getRaw(tag); value != nil {
if js, ok := eventJsFunc[tag]; ok {
if listeners, ok := value.([]func(View, MouseEvent)); ok && len(listeners) > 0 {
buffer.WriteString(js.jsEvent)
buffer.WriteString(`="`)
buffer.WriteString(js.jsFunc)
buffer.WriteString(`(this, event)" `)
}
}
}
}
if hasTooltip {
buffer.WriteString(`onmouseenter="mouseEnterEvent(this, event)" `)
buffer.WriteString(`onmouseleave="mouseLeaveEvent(this, event)" `)
}
}
*/
func getTimeStamp(data DataObject) uint64 { func getTimeStamp(data DataObject) uint64 {
if value, ok := data.PropertyValue("timeStamp"); ok { if value, ok := data.PropertyValue("timeStamp"); ok {
if index := strings.Index(value, "."); index > 0 { if index := strings.Index(value, "."); index > 0 {

View File

@ -154,45 +154,6 @@ type PointerEvent struct {
IsPrimary bool IsPrimary bool
} }
/*
func setPointerListener(properties Properties, tag PropertyName, value any) bool {
if listeners, ok := valueToOneArgEventListeners[View, PointerEvent](value); ok {
if len(listeners) == 0 {
properties.setRaw(tag, nil)
} else {
properties.setRaw(tag, listeners)
}
return true
}
notCompatibleType(tag, value)
return false
}
func (view *viewData) removePointerListener(tag PropertyName) {
delete(view.properties, tag)
if view.created {
if js, ok := eventJsFunc[tag]; ok {
view.session.removeProperty(view.htmlID(), js.jsEvent)
}
}
}
func pointerEventsHtml(view View, buffer *strings.Builder) {
for _, tag := range []PropertyName{PointerDown, PointerUp, PointerMove, PointerOut, PointerOver, PointerCancel} {
if value := view.getRaw(tag); value != nil {
if js, ok := eventJsFunc[tag]; ok {
if listeners, ok := value.([]func(View, PointerEvent)); ok && len(listeners) > 0 {
buffer.WriteString(js.jsEvent)
buffer.WriteString(`="`)
buffer.WriteString(js.jsFunc)
buffer.WriteString(`(this, event)" `)
}
}
}
}
}
*/
func (event *PointerEvent) init(data DataObject) { func (event *PointerEvent) init(data DataObject) {
event.MouseEvent.init(data) event.MouseEvent.init(data)

View File

@ -624,8 +624,8 @@ func radiusPropertySet(radius Properties, tag PropertyName, value any) []Propert
case string: case string:
if strings.Contains(value, "/") { if strings.Contains(value, "/") {
if values := strings.Split(value, "/"); len(values) == 2 { if values := strings.Split(value, "/"); len(values) == 2 {
if result = radiusPropertySet(radius, tag+"-x", value[0]); result != nil { if result = radiusPropertySet(radius, tag+"-x", values[0]); result != nil {
if resultY := radiusPropertySet(radius, tag+"-y", value[1]); resultY != nil { if resultY := radiusPropertySet(radius, tag+"-y", values[1]); resultY != nil {
result = append(result, resultY...) result = append(result, resultY...)
} }

View File

@ -142,45 +142,6 @@ type TouchEvent struct {
MetaKey bool MetaKey bool
} }
/*
func setTouchListener(properties Properties, tag PropertyName, value any) bool {
if listeners, ok := valueToOneArgEventListeners[View, TouchEvent](value); ok {
if len(listeners) == 0 {
properties.setRaw(tag, nil)
} else {
properties.setRaw(tag, listeners)
}
return true
}
notCompatibleType(tag, value)
return false
}
func (view *viewData) removeTouchListener(tag PropertyName) {
delete(view.properties, tag)
if view.created {
if js, ok := eventJsFunc[tag]; ok {
view.session.removeProperty(view.htmlID(), js.jsEvent)
}
}
}
func touchEventsHtml(view View, buffer *strings.Builder) {
for _, tag := range []PropertyName{TouchStart, TouchEnd, TouchMove, TouchCancel} {
if value := view.getRaw(tag); value != nil {
if js, ok := eventJsFunc[tag]; ok {
if listeners, ok := value.([]func(View, TouchEvent)); ok && len(listeners) > 0 {
buffer.WriteString(js.jsEvent)
buffer.WriteString(`="`)
buffer.WriteString(js.jsFunc)
buffer.WriteString(`(this, event)" `)
}
}
}
}
}
*/
func (event *TouchEvent) init(data DataObject) { func (event *TouchEvent) init(data DataObject) {
event.Touches = []Touch{} event.Touches = []Touch{}