forked from mbk-lab/rui_orig
2
0
Fork 0

Bug fixing

This commit is contained in:
anoshenko 2022-11-23 15:10:29 +03:00
parent 7bb4da32bf
commit d3002ced0e
24 changed files with 64 additions and 60 deletions

View File

@ -72,7 +72,7 @@
# v0.2.0
* Added "animation" and "transition" properties, Animation interface, animation events
* Renamed ColorPropery constant to ColorTag
* Renamed ColorProperty constant to ColorTag
* Updated readme
* Added the Animation example to the demo
* Bug fixing

View File

@ -85,7 +85,7 @@ const (
LinearTiming = "linear"
)
// StepsTiming return a timing function along stepCount stops along the transition, diplaying each stop for equal lengths of time
// StepsTiming return a timing function along stepCount stops along the transition, displaying each stop for equal lengths of time
func StepsTiming(stepCount int) string {
return "steps(" + strconv.Itoa(stepCount) + ")"
}
@ -130,7 +130,7 @@ type Animation interface {
writeTransitionString(tag string, buffer *strings.Builder)
animationCSS(session Session) string
transitionCSS(buffer *strings.Builder, session Session)
hasAnimatedPropery() bool
hasAnimatedProperty() bool
animationName() string
}
@ -160,7 +160,7 @@ func NewAnimation(params Params) Animation {
return animation
}
func (animation *animationData) hasAnimatedPropery() bool {
func (animation *animationData) hasAnimatedProperty() bool {
props := animation.getRaw(PropertyTag)
if props == nil {
ErrorLog("There are no animated properties.")

View File

@ -30,7 +30,7 @@ const (
AnimationStartEvent = "animation-start-event"
// AnimationEndEvent is the constant for "animation-end-event" property tag.
// The "animation-end-event" is fired when aт фnimation has completed.
// The "animation-end-event" is fired when an animation has completed.
// If the animation aborts before reaching completion, such as if the element is removed
// or the animation is removed from the element, the "animation-end-event" is not fired.
AnimationEndEvent = "animation-end-event"
@ -46,7 +46,7 @@ const (
// AnimationIterationEvent is the constant for "animation-iteration-event" property tag.
// The "animation-iteration-event" is fired when an iteration of an animation ends,
// and another one begins. This event does not occur at the same time as the animationend event,
// and another one begins. This event does not occur at the same time as the animation end event,
// and therefore does not occur for animations with an "iteration-count" of one.
AnimationIterationEvent = "animation-iteration-event"
)

View File

@ -1339,7 +1339,7 @@ function mediaSetVolume(elementId, volume) {
}
}
function startDowndload(url, filename) {
function startDownload(url, filename) {
var element = document.getElementById("ruiDownloader");
if (element) {
element.href = url;

View File

@ -209,7 +209,7 @@ func (gradient *backgroundConicGradient) parseGradientText(value string) []Backg
for i, element := range elements {
var ok bool
if vector[i], ok = gradient.stringToGradientPoint(strings.Trim(element, " ")); !ok {
ErrorLogF(`Ivalid %d element of the conic gradient: "%s"`, i, element)
ErrorLogF(`Invalid %d element of the conic gradient: "%s"`, i, element)
return nil
}
}
@ -240,7 +240,7 @@ func (gradient *backgroundConicGradient) setGradient(value any) bool {
return true
}
ErrorLogF(`Ivalid conic gradient: "%s"`, value)
ErrorLogF(`Invalid conic gradient: "%s"`, value)
return false
case []BackgroundGradientAngle:
@ -252,7 +252,7 @@ func (gradient *backgroundConicGradient) setGradient(value any) bool {
for i, point := range value {
if point.Color == nil {
ErrorLogF("Ivalid %d element of the conic gradient: Color is nil", i)
ErrorLogF("Invalid %d element of the conic gradient: Color is nil", i)
return false
}
}

View File

@ -99,7 +99,7 @@ func (gradient *backgroundGradient) parseGradientText(value string) []Background
points := make([]BackgroundGradientPoint, count)
for i, element := range elements {
if !points[i].setValue(element) {
ErrorLogF(`Ivalid %d element of the conic gradient: "%s"`, i, element)
ErrorLogF(`Invalid %d element of the conic gradient: "%s"`, i, element)
return nil
}
}

View File

@ -182,7 +182,7 @@ type Canvas interface {
SetRadialGradientStrokeStyle(x0, y0, r0 float64, color0 Color, x1, y1, r1 float64, color1 Color, stopPoints []GradientPoint)
// SetImageFillStyle set the image as the filling pattern.
// repeate - indicating how to repeat the pattern's image. Possible values are:
// repeat - indicating how to repeat the pattern's image. Possible values are:
// NoRepeat (0) - neither direction,
// RepeatXY (1) - both directions,
// RepeatX (2) - horizontal only,
@ -286,7 +286,7 @@ type Canvas interface {
DrawImage(x, y float64, image Image)
// DrawImageInRect draws the image in the rectangle (x, y, width, height), scaling in height and width if necessary
DrawImageInRect(x, y, width, height float64, image Image)
// DrawImageFragment draws the frament (described by srcX, srcY, srcWidth, srcHeight) of image
// DrawImageFragment draws the fragment (described by srcX, srcY, srcWidth, srcHeight) of image
// in the rectangle (dstX, dstY, dstWidth, dstHeight), scaling in height and width if necessary
DrawImageFragment(srcX, srcY, srcWidth, srcHeight, dstX, dstY, dstWidth, dstHeight float64, image Image)
@ -302,12 +302,12 @@ func newCanvas(view CanvasView) Canvas {
canvas := new(canvasData)
canvas.view = view
canvas.session = view.Session()
canvas.session.cavnasStart(view.htmlID())
canvas.session.canvasStart(view.htmlID())
return canvas
}
func (canvas *canvasData) finishDraw() {
canvas.session.cavnasFinish()
canvas.session.canvasFinish()
}
func (canvas *canvasData) View() CanvasView {

View File

@ -55,8 +55,8 @@ const (
BlueViolet Color = 0xff8a2be2
// Brown color constant
Brown Color = 0xffa52a2a
// Burlywood color constant
Burlywood Color = 0xffdeb887
// BurlyWood color constant
BurlyWood Color = 0xffdeb887
// CadetBlue color constant
CadetBlue Color = 0xff5f9ea0
// Chartreuse color constant
@ -67,8 +67,8 @@ const (
Coral Color = 0xffff7f50
// CornflowerBlue color constant
CornflowerBlue Color = 0xff6495ed
// Cornsilk color constant
Cornsilk Color = 0xfffff8dc
// CornSilk color constant
CornSilk Color = 0xfffff8dc
// Crimson color constant
Crimson Color = 0xffdc143c
// Cyan color constant
@ -105,8 +105,8 @@ const (
DarkSlateBlue Color = 0xff483d8b
// DarkSlateGray color constant
DarkSlateGray Color = 0xff2f4f4f
// Darkslategrey color constant
Darkslategrey Color = 0xff2f4f4f
// DarkSlateGrey color constant
DarkSlateGrey Color = 0xff2f4f4f
// DarkTurquoise color constant
DarkTurquoise Color = 0xff00ced1
// DarkViolet color constant
@ -135,8 +135,8 @@ const (
Gold Color = 0xffffd700
// GoldenRod color constant
GoldenRod Color = 0xffdaa520
// GreenyEllow color constant
GreenyEllow Color = 0xffadff2f
// GreenYellow color constant
GreenYellow Color = 0xffadff2f
// Grey color constant
Grey Color = 0xff808080
// Honeydew color constant
@ -293,8 +293,8 @@ const (
Violet Color = 0xffee82ee
// Wheat color constant
Wheat Color = 0xfff5deb3
// Whitesmoke color constant
Whitesmoke Color = 0xfff5f5f5
// WhiteSmoke color constant
WhiteSmoke Color = 0xfff5f5f5
// YellowGreen color constant
YellowGreen Color = 0xff9acd32
)

View File

@ -23,7 +23,7 @@ func (session *sessionData) startDownload(file downloadFile) {
currentDownloadId++
id := strconv.Itoa(currentDownloadId)
downloadFiles[id] = file
session.callFunc("startDowndload", id, file.filename)
session.callFunc("startDownload", id, file.filename)
}
func serveDownloadFile(id string, w http.ResponseWriter, r *http.Request) bool {

View File

@ -23,7 +23,7 @@ const (
PasswordText = 1
// EmailText - e-mail type of EditView. Allows to enter one email
EmailText = 2
// EmailsText - e-mail type of EditView. Allows to enter multiple emails separeted by comma
// EmailsText - e-mail type of EditView. Allows to enter multiple emails separated by comma
EmailsText = 3
// URLText - url type of EditView. Allows to enter one url
URLText = 4
@ -531,7 +531,7 @@ func GetHint(view View, subviewID ...string) string {
return ""
}
// GetMaxLength returns a maximal lenght of EditView. If a maximal lenght is not limited then 0 is returned
// GetMaxLength returns a maximal length of EditView. If a maximal length is not limited then 0 is returned
// If the second argument (subviewID) is not specified or it is "" then a value of the first argument (view) is returned.
func GetMaxLength(view View, subviewID ...string) int {
return intStyledProperty(view, subviewID, MaxLength, 0)
@ -604,7 +604,7 @@ func AppendEditText(view View, subviewID string, text string) {
}
}
// GetCaretColor returns the color of the text input carret.
// GetCaretColor returns the color of the text input caret.
// If the second argument (subviewID) is not specified or it is "" then a value from the first argument (view) is returned.
func GetCaretColor(view View, subviewID ...string) Color {
return colorStyledProperty(view, subviewID, CaretColor, false)

View File

@ -47,7 +47,7 @@ const (
// ListView - the list view interface
type ListView interface {
View
ParanetView
ParentView
// ReloadListViewData updates ListView content
ReloadListViewData()

View File

@ -421,7 +421,7 @@ const (
// This is an inherited property, i.e. if it is not defined, then the value of the parent view is used.
VerticalTextOrientation = "vertical-text-orientation"
// TextTverflow is the constant for the "text-overflow" property tag.
// TextOverflow is the constant for the "text-overflow" property tag.
// The "text-overflow" int property sets how hidden overflow content is signaled to users.
// It can be clipped or display an ellipsis ('…'). Valid values are
TextOverflow = "text-overflow"
@ -538,7 +538,7 @@ const (
// AvoidBreak is the constant for the "avoid-break" property tag.
// The "avoid-break" bool property sets how region breaks should behave inside a generated box.
// If the property value is "true" then fvoids any break from being inserted within the principal box.
// If the property value is "true" then avoids any break from being inserted within the principal box.
// If the property value is "false" then allows, but does not force, any break to be inserted within
// the principal box.
AvoidBreak = "avoid-break"
@ -656,7 +656,7 @@ const (
// allowing text and inline Views to wrap around it.
Float = "float"
// UsetData is the constant for the "user-data" property tag.
// UserData is the constant for the "user-data" property tag.
// The "user-data" property can contain any user data
UserData = "user-data"

View File

@ -34,7 +34,7 @@ const (
// Resizable - grid-container of View
type Resizable interface {
View
ParanetView
ParentView
}
type resizableData struct {

View File

@ -20,13 +20,13 @@ type webBridge interface {
writeMessage(text string) bool
addAnimationCSS(css string)
clearAnimation()
cavnasStart(htmlID string)
canvasStart(htmlID string)
callCanvasFunc(funcName string, args ...any)
callCanvasVarFunc(v any, funcName string, args ...any)
callCanvasImageFunc(url string, property string, funcName string, args ...any)
createCanvasVar(funcName string, args ...any) any
updateCanvasProperty(property string, value any)
cavnasFinish()
canvasFinish()
canvasTextMetrics(htmlID, font, text string) TextMetrics
htmlPropertyValue(htmlID, name string) string
answerReceived(answer DataObject)
@ -125,13 +125,13 @@ type Session interface {
finishUpdateScript(htmlID string)
addAnimationCSS(css string)
clearAnimation()
cavnasStart(htmlID string)
canvasStart(htmlID string)
callCanvasFunc(funcName string, args ...any)
createCanvasVar(funcName string, args ...any) any
callCanvasVarFunc(v any, funcName string, args ...any)
callCanvasImageFunc(url string, property string, funcName string, args ...any)
updateCanvasProperty(property string, value any)
cavnasFinish()
canvasFinish()
canvasTextMetrics(htmlID, font, text string) TextMetrics
htmlPropertyValue(htmlID, name string) string
handleAnswer(data DataObject)
@ -290,7 +290,11 @@ func (session *sessionData) writeInitScript(writer *strings.Builder) {
if session.rootView != nil {
writer.WriteString(`document.getElementById('ruiRootView').innerHTML = '`)
viewHTML(session.rootView, writer)
buffer := allocStringBuilder()
defer freeStringBuilder(buffer)
viewHTML(session.rootView, buffer)
text := strings.ReplaceAll(buffer.String(), "'", `\'`)
writer.WriteString(text)
writer.WriteString("';\nscanElementsSize();")
}
}
@ -424,9 +428,9 @@ func (session *sessionData) clearAnimation() {
}
}
func (session *sessionData) cavnasStart(htmlID string) {
func (session *sessionData) canvasStart(htmlID string) {
if session.bridge != nil {
session.bridge.cavnasStart(htmlID)
session.bridge.canvasStart(htmlID)
}
}
@ -461,9 +465,9 @@ func (session *sessionData) callCanvasImageFunc(url string, property string, fun
}
}
func (session *sessionData) cavnasFinish() {
func (session *sessionData) canvasFinish() {
if session.bridge != nil {
session.bridge.cavnasFinish()
session.bridge.canvasFinish()
}
}

View File

@ -42,7 +42,7 @@ func viewByHTMLID(id string, startView View) View {
if startView.htmlID() == id {
return startView
}
if container, ok := startView.(ParanetView); ok {
if container, ok := startView.(ParentView); ok {
for _, view := range container.Views() {
if view != nil {
if v := viewByHTMLID(id, view); v != nil {

View File

@ -104,7 +104,7 @@ func (data *sizeFuncData) parseArgs(args []any, allowNumber bool) bool {
}
}
ErrorLogF(`The %s function argument cann't be a number`, data.tag)
ErrorLogF(`The %s function argument can't be a number`, data.tag)
return false
}

View File

@ -218,7 +218,7 @@ type CellIndex struct {
// TableView - text View
type TableView interface {
View
ParanetView
ParentView
ReloadTableData()
CellFrame(row, column int) Frame

View File

@ -94,7 +94,7 @@ func GetTableSelectionMode(view View, subviewID ...string) int {
return enumStyledProperty(view, subviewID, SelectionMode, NoneSelection, false)
}
// GetTableVerticalAlign returns a vertical align in a TavleView cell. Returns one of next values:
// GetTableVerticalAlign returns a vertical align in a TableView cell. Returns one of next values:
// TopAlign (0), BottomAlign (1), CenterAlign (2), and BaselineAlign (3)
// If the second argument (subviewID) is not specified or it is "" then a value from the first argument (view) is returned.
func GetTableVerticalAlign(view View, subviewID ...string) int {

View File

@ -45,7 +45,7 @@ type View interface {
Focusable() bool
// Frame returns the location and size of the view in pixels
Frame() Frame
// Scroll returns the location size of the scrolable view in pixels
// Scroll returns the location size of the scrollable view in pixels
Scroll() Frame
// SetAnimated sets the value (second argument) of the property with name defined by the first argument.
// Return "true" if the value has been set, in the opposite case "false" are returned and

View File

@ -12,7 +12,7 @@ func ViewByID(rootView View, id string) View {
return rootView
}
if container, ok := rootView.(ParanetView); ok {
if container, ok := rootView.(ParentView); ok {
if view := viewByID(container, id); view != nil {
return view
}
@ -32,13 +32,13 @@ func ViewByID(rootView View, id string) View {
return nil
}
func viewByID(rootView ParanetView, id string) View {
func viewByID(rootView ParentView, id string) View {
for _, view := range rootView.Views() {
if view != nil {
if view.ID() == id {
return view
}
if container, ok := view.(ParanetView); ok {
if container, ok := view.(ParentView); ok {
if v := viewByID(container, id); v != nil {
return v
}

View File

@ -338,7 +338,7 @@ func (style *viewStyle) set(tag string, value any) bool {
return true
case DataObject:
if animation := parseAnimation(value); animation.hasAnimatedPropery() {
if animation := parseAnimation(value); animation.hasAnimatedProperty() {
style.properties[tag] = []Animation{animation}
return true
}
@ -348,7 +348,7 @@ func (style *viewStyle) set(tag string, value any) bool {
result := true
for i := 0; i < value.ArraySize(); i++ {
if obj := value.ArrayElement(i).Object(); obj != nil {
if anim := parseAnimation(obj); anim.hasAnimatedPropery() {
if anim := parseAnimation(obj); anim.hasAnimatedProperty() {
animations = append(animations, anim)
} else {
result = false

View File

@ -2,7 +2,7 @@ package rui
import "strings"
type ParanetView interface {
type ParentView interface {
// Views return a list of child views
Views() []View
}
@ -10,7 +10,7 @@ type ParanetView interface {
// ViewsContainer - mutable list-container of Views
type ViewsContainer interface {
View
ParanetView
ParentView
// Append appends a view to the end of the list of a view children
Append(view View)
// Insert inserts a view to the "index" position in the list of a view children

View File

@ -135,7 +135,7 @@ func (bridge *wasmBridge) clearAnimation() {
styles.Set("textContent", "")
}
func (bridge *wasmBridge) cavnasStart(htmlID string) {
func (bridge *wasmBridge) canvasStart(htmlID string) {
if ProtocolInDebugLog {
DebugLog("const ctx = document.getElementById('" + htmlID + "'elementId').getContext('2d');\nctx.save();")
}
@ -204,7 +204,7 @@ func (bridge *wasmBridge) updateCanvasProperty(property string, value any) {
}
}
func (bridge *wasmBridge) cavnasFinish() {
func (bridge *wasmBridge) canvasFinish() {
if !bridge.canvas.IsNull() {
DebugLog("ctx.restore()")
bridge.canvas.Call("restore")

View File

@ -146,7 +146,7 @@ func (bridge *wsBridge) argToString(arg any) (string, bool) {
}
}
ErrorLog("Unsupported agument type")
ErrorLog("Unsupported argument type")
return "", false
}
@ -238,7 +238,7 @@ if (styles) {
}`)
}
func (bridge *wsBridge) cavnasStart(htmlID string) {
func (bridge *wsBridge) canvasStart(htmlID string) {
bridge.canvasBuffer.Reset()
bridge.canvasBuffer.WriteString(`const ctx = getCanvasContext('`)
bridge.canvasBuffer.WriteString(htmlID)
@ -328,7 +328,7 @@ func (bridge *wsBridge) callCanvasImageFunc(url string, property string, funcNam
bridge.canvasBuffer.WriteString(");\n}")
}
func (bridge *wsBridge) cavnasFinish() {
func (bridge *wsBridge) canvasFinish() {
bridge.canvasBuffer.WriteString("\n")
script := bridge.canvasBuffer.String()
if ProtocolInDebugLog {