forked from mbk-lab/rui_orig
Bug fixing
This commit is contained in:
parent
7bb4da32bf
commit
d3002ced0e
|
@ -72,7 +72,7 @@
|
||||||
# v0.2.0
|
# v0.2.0
|
||||||
|
|
||||||
* Added "animation" and "transition" properties, Animation interface, animation events
|
* Added "animation" and "transition" properties, Animation interface, animation events
|
||||||
* Renamed ColorPropery constant to ColorTag
|
* Renamed ColorProperty constant to ColorTag
|
||||||
* Updated readme
|
* Updated readme
|
||||||
* Added the Animation example to the demo
|
* Added the Animation example to the demo
|
||||||
* Bug fixing
|
* Bug fixing
|
||||||
|
|
|
@ -85,7 +85,7 @@ const (
|
||||||
LinearTiming = "linear"
|
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 {
|
func StepsTiming(stepCount int) string {
|
||||||
return "steps(" + strconv.Itoa(stepCount) + ")"
|
return "steps(" + strconv.Itoa(stepCount) + ")"
|
||||||
}
|
}
|
||||||
|
@ -130,7 +130,7 @@ type Animation interface {
|
||||||
writeTransitionString(tag string, buffer *strings.Builder)
|
writeTransitionString(tag string, buffer *strings.Builder)
|
||||||
animationCSS(session Session) string
|
animationCSS(session Session) string
|
||||||
transitionCSS(buffer *strings.Builder, session Session)
|
transitionCSS(buffer *strings.Builder, session Session)
|
||||||
hasAnimatedPropery() bool
|
hasAnimatedProperty() bool
|
||||||
animationName() string
|
animationName() string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -160,7 +160,7 @@ func NewAnimation(params Params) Animation {
|
||||||
return animation
|
return animation
|
||||||
}
|
}
|
||||||
|
|
||||||
func (animation *animationData) hasAnimatedPropery() bool {
|
func (animation *animationData) hasAnimatedProperty() bool {
|
||||||
props := animation.getRaw(PropertyTag)
|
props := animation.getRaw(PropertyTag)
|
||||||
if props == nil {
|
if props == nil {
|
||||||
ErrorLog("There are no animated properties.")
|
ErrorLog("There are no animated properties.")
|
||||||
|
|
|
@ -30,7 +30,7 @@ const (
|
||||||
AnimationStartEvent = "animation-start-event"
|
AnimationStartEvent = "animation-start-event"
|
||||||
|
|
||||||
// AnimationEndEvent is the constant for "animation-end-event" property tag.
|
// 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
|
// 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.
|
// or the animation is removed from the element, the "animation-end-event" is not fired.
|
||||||
AnimationEndEvent = "animation-end-event"
|
AnimationEndEvent = "animation-end-event"
|
||||||
|
@ -46,7 +46,7 @@ const (
|
||||||
|
|
||||||
// AnimationIterationEvent is the constant for "animation-iteration-event" property tag.
|
// AnimationIterationEvent is the constant for "animation-iteration-event" property tag.
|
||||||
// The "animation-iteration-event" is fired when an iteration of an animation ends,
|
// 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.
|
// and therefore does not occur for animations with an "iteration-count" of one.
|
||||||
AnimationIterationEvent = "animation-iteration-event"
|
AnimationIterationEvent = "animation-iteration-event"
|
||||||
)
|
)
|
||||||
|
|
|
@ -1339,7 +1339,7 @@ function mediaSetVolume(elementId, volume) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function startDowndload(url, filename) {
|
function startDownload(url, filename) {
|
||||||
var element = document.getElementById("ruiDownloader");
|
var element = document.getElementById("ruiDownloader");
|
||||||
if (element) {
|
if (element) {
|
||||||
element.href = url;
|
element.href = url;
|
||||||
|
|
|
@ -209,7 +209,7 @@ func (gradient *backgroundConicGradient) parseGradientText(value string) []Backg
|
||||||
for i, element := range elements {
|
for i, element := range elements {
|
||||||
var ok bool
|
var ok bool
|
||||||
if vector[i], ok = gradient.stringToGradientPoint(strings.Trim(element, " ")); !ok {
|
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
|
return nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -240,7 +240,7 @@ func (gradient *backgroundConicGradient) setGradient(value any) bool {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
ErrorLogF(`Ivalid conic gradient: "%s"`, value)
|
ErrorLogF(`Invalid conic gradient: "%s"`, value)
|
||||||
return false
|
return false
|
||||||
|
|
||||||
case []BackgroundGradientAngle:
|
case []BackgroundGradientAngle:
|
||||||
|
@ -252,7 +252,7 @@ func (gradient *backgroundConicGradient) setGradient(value any) bool {
|
||||||
|
|
||||||
for i, point := range value {
|
for i, point := range value {
|
||||||
if point.Color == nil {
|
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
|
return false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -99,7 +99,7 @@ func (gradient *backgroundGradient) parseGradientText(value string) []Background
|
||||||
points := make([]BackgroundGradientPoint, count)
|
points := make([]BackgroundGradientPoint, count)
|
||||||
for i, element := range elements {
|
for i, element := range elements {
|
||||||
if !points[i].setValue(element) {
|
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
|
return nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -182,7 +182,7 @@ type Canvas interface {
|
||||||
SetRadialGradientStrokeStyle(x0, y0, r0 float64, color0 Color, x1, y1, r1 float64, color1 Color, stopPoints []GradientPoint)
|
SetRadialGradientStrokeStyle(x0, y0, r0 float64, color0 Color, x1, y1, r1 float64, color1 Color, stopPoints []GradientPoint)
|
||||||
|
|
||||||
// SetImageFillStyle set the image as the filling pattern.
|
// 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,
|
// NoRepeat (0) - neither direction,
|
||||||
// RepeatXY (1) - both directions,
|
// RepeatXY (1) - both directions,
|
||||||
// RepeatX (2) - horizontal only,
|
// RepeatX (2) - horizontal only,
|
||||||
|
@ -286,7 +286,7 @@ type Canvas interface {
|
||||||
DrawImage(x, y float64, image Image)
|
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 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)
|
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
|
// 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)
|
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 := new(canvasData)
|
||||||
canvas.view = view
|
canvas.view = view
|
||||||
canvas.session = view.Session()
|
canvas.session = view.Session()
|
||||||
canvas.session.cavnasStart(view.htmlID())
|
canvas.session.canvasStart(view.htmlID())
|
||||||
return canvas
|
return canvas
|
||||||
}
|
}
|
||||||
|
|
||||||
func (canvas *canvasData) finishDraw() {
|
func (canvas *canvasData) finishDraw() {
|
||||||
canvas.session.cavnasFinish()
|
canvas.session.canvasFinish()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (canvas *canvasData) View() CanvasView {
|
func (canvas *canvasData) View() CanvasView {
|
||||||
|
|
|
@ -55,8 +55,8 @@ const (
|
||||||
BlueViolet Color = 0xff8a2be2
|
BlueViolet Color = 0xff8a2be2
|
||||||
// Brown color constant
|
// Brown color constant
|
||||||
Brown Color = 0xffa52a2a
|
Brown Color = 0xffa52a2a
|
||||||
// Burlywood color constant
|
// BurlyWood color constant
|
||||||
Burlywood Color = 0xffdeb887
|
BurlyWood Color = 0xffdeb887
|
||||||
// CadetBlue color constant
|
// CadetBlue color constant
|
||||||
CadetBlue Color = 0xff5f9ea0
|
CadetBlue Color = 0xff5f9ea0
|
||||||
// Chartreuse color constant
|
// Chartreuse color constant
|
||||||
|
@ -67,8 +67,8 @@ const (
|
||||||
Coral Color = 0xffff7f50
|
Coral Color = 0xffff7f50
|
||||||
// CornflowerBlue color constant
|
// CornflowerBlue color constant
|
||||||
CornflowerBlue Color = 0xff6495ed
|
CornflowerBlue Color = 0xff6495ed
|
||||||
// Cornsilk color constant
|
// CornSilk color constant
|
||||||
Cornsilk Color = 0xfffff8dc
|
CornSilk Color = 0xfffff8dc
|
||||||
// Crimson color constant
|
// Crimson color constant
|
||||||
Crimson Color = 0xffdc143c
|
Crimson Color = 0xffdc143c
|
||||||
// Cyan color constant
|
// Cyan color constant
|
||||||
|
@ -105,8 +105,8 @@ const (
|
||||||
DarkSlateBlue Color = 0xff483d8b
|
DarkSlateBlue Color = 0xff483d8b
|
||||||
// DarkSlateGray color constant
|
// DarkSlateGray color constant
|
||||||
DarkSlateGray Color = 0xff2f4f4f
|
DarkSlateGray Color = 0xff2f4f4f
|
||||||
// Darkslategrey color constant
|
// DarkSlateGrey color constant
|
||||||
Darkslategrey Color = 0xff2f4f4f
|
DarkSlateGrey Color = 0xff2f4f4f
|
||||||
// DarkTurquoise color constant
|
// DarkTurquoise color constant
|
||||||
DarkTurquoise Color = 0xff00ced1
|
DarkTurquoise Color = 0xff00ced1
|
||||||
// DarkViolet color constant
|
// DarkViolet color constant
|
||||||
|
@ -135,8 +135,8 @@ const (
|
||||||
Gold Color = 0xffffd700
|
Gold Color = 0xffffd700
|
||||||
// GoldenRod color constant
|
// GoldenRod color constant
|
||||||
GoldenRod Color = 0xffdaa520
|
GoldenRod Color = 0xffdaa520
|
||||||
// GreenyEllow color constant
|
// GreenYellow color constant
|
||||||
GreenyEllow Color = 0xffadff2f
|
GreenYellow Color = 0xffadff2f
|
||||||
// Grey color constant
|
// Grey color constant
|
||||||
Grey Color = 0xff808080
|
Grey Color = 0xff808080
|
||||||
// Honeydew color constant
|
// Honeydew color constant
|
||||||
|
@ -293,8 +293,8 @@ const (
|
||||||
Violet Color = 0xffee82ee
|
Violet Color = 0xffee82ee
|
||||||
// Wheat color constant
|
// Wheat color constant
|
||||||
Wheat Color = 0xfff5deb3
|
Wheat Color = 0xfff5deb3
|
||||||
// Whitesmoke color constant
|
// WhiteSmoke color constant
|
||||||
Whitesmoke Color = 0xfff5f5f5
|
WhiteSmoke Color = 0xfff5f5f5
|
||||||
// YellowGreen color constant
|
// YellowGreen color constant
|
||||||
YellowGreen Color = 0xff9acd32
|
YellowGreen Color = 0xff9acd32
|
||||||
)
|
)
|
||||||
|
|
|
@ -23,7 +23,7 @@ func (session *sessionData) startDownload(file downloadFile) {
|
||||||
currentDownloadId++
|
currentDownloadId++
|
||||||
id := strconv.Itoa(currentDownloadId)
|
id := strconv.Itoa(currentDownloadId)
|
||||||
downloadFiles[id] = file
|
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 {
|
func serveDownloadFile(id string, w http.ResponseWriter, r *http.Request) bool {
|
||||||
|
|
|
@ -23,7 +23,7 @@ const (
|
||||||
PasswordText = 1
|
PasswordText = 1
|
||||||
// EmailText - e-mail type of EditView. Allows to enter one email
|
// EmailText - e-mail type of EditView. Allows to enter one email
|
||||||
EmailText = 2
|
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
|
EmailsText = 3
|
||||||
// URLText - url type of EditView. Allows to enter one url
|
// URLText - url type of EditView. Allows to enter one url
|
||||||
URLText = 4
|
URLText = 4
|
||||||
|
@ -531,7 +531,7 @@ func GetHint(view View, subviewID ...string) string {
|
||||||
return ""
|
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.
|
// 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 {
|
func GetMaxLength(view View, subviewID ...string) int {
|
||||||
return intStyledProperty(view, subviewID, MaxLength, 0)
|
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.
|
// 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 {
|
func GetCaretColor(view View, subviewID ...string) Color {
|
||||||
return colorStyledProperty(view, subviewID, CaretColor, false)
|
return colorStyledProperty(view, subviewID, CaretColor, false)
|
||||||
|
|
|
@ -47,7 +47,7 @@ const (
|
||||||
// ListView - the list view interface
|
// ListView - the list view interface
|
||||||
type ListView interface {
|
type ListView interface {
|
||||||
View
|
View
|
||||||
ParanetView
|
ParentView
|
||||||
// ReloadListViewData updates ListView content
|
// ReloadListViewData updates ListView content
|
||||||
ReloadListViewData()
|
ReloadListViewData()
|
||||||
|
|
||||||
|
|
|
@ -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.
|
// 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"
|
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.
|
// 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
|
// It can be clipped or display an ellipsis ('…'). Valid values are
|
||||||
TextOverflow = "text-overflow"
|
TextOverflow = "text-overflow"
|
||||||
|
@ -538,7 +538,7 @@ const (
|
||||||
|
|
||||||
// AvoidBreak is the constant for the "avoid-break" property tag.
|
// 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.
|
// 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
|
// If the property value is "false" then allows, but does not force, any break to be inserted within
|
||||||
// the principal box.
|
// the principal box.
|
||||||
AvoidBreak = "avoid-break"
|
AvoidBreak = "avoid-break"
|
||||||
|
@ -656,7 +656,7 @@ const (
|
||||||
// allowing text and inline Views to wrap around it.
|
// allowing text and inline Views to wrap around it.
|
||||||
Float = "float"
|
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
|
// The "user-data" property can contain any user data
|
||||||
UserData = "user-data"
|
UserData = "user-data"
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,7 @@ const (
|
||||||
// Resizable - grid-container of View
|
// Resizable - grid-container of View
|
||||||
type Resizable interface {
|
type Resizable interface {
|
||||||
View
|
View
|
||||||
ParanetView
|
ParentView
|
||||||
}
|
}
|
||||||
|
|
||||||
type resizableData struct {
|
type resizableData struct {
|
||||||
|
|
22
session.go
22
session.go
|
@ -20,13 +20,13 @@ type webBridge interface {
|
||||||
writeMessage(text string) bool
|
writeMessage(text string) bool
|
||||||
addAnimationCSS(css string)
|
addAnimationCSS(css string)
|
||||||
clearAnimation()
|
clearAnimation()
|
||||||
cavnasStart(htmlID string)
|
canvasStart(htmlID string)
|
||||||
callCanvasFunc(funcName string, args ...any)
|
callCanvasFunc(funcName string, args ...any)
|
||||||
callCanvasVarFunc(v any, funcName string, args ...any)
|
callCanvasVarFunc(v any, funcName string, args ...any)
|
||||||
callCanvasImageFunc(url string, property string, funcName string, args ...any)
|
callCanvasImageFunc(url string, property string, funcName string, args ...any)
|
||||||
createCanvasVar(funcName string, args ...any) any
|
createCanvasVar(funcName string, args ...any) any
|
||||||
updateCanvasProperty(property string, value any)
|
updateCanvasProperty(property string, value any)
|
||||||
cavnasFinish()
|
canvasFinish()
|
||||||
canvasTextMetrics(htmlID, font, text string) TextMetrics
|
canvasTextMetrics(htmlID, font, text string) TextMetrics
|
||||||
htmlPropertyValue(htmlID, name string) string
|
htmlPropertyValue(htmlID, name string) string
|
||||||
answerReceived(answer DataObject)
|
answerReceived(answer DataObject)
|
||||||
|
@ -125,13 +125,13 @@ type Session interface {
|
||||||
finishUpdateScript(htmlID string)
|
finishUpdateScript(htmlID string)
|
||||||
addAnimationCSS(css string)
|
addAnimationCSS(css string)
|
||||||
clearAnimation()
|
clearAnimation()
|
||||||
cavnasStart(htmlID string)
|
canvasStart(htmlID string)
|
||||||
callCanvasFunc(funcName string, args ...any)
|
callCanvasFunc(funcName string, args ...any)
|
||||||
createCanvasVar(funcName string, args ...any) any
|
createCanvasVar(funcName string, args ...any) any
|
||||||
callCanvasVarFunc(v any, funcName string, args ...any)
|
callCanvasVarFunc(v any, funcName string, args ...any)
|
||||||
callCanvasImageFunc(url string, property string, funcName string, args ...any)
|
callCanvasImageFunc(url string, property string, funcName string, args ...any)
|
||||||
updateCanvasProperty(property string, value any)
|
updateCanvasProperty(property string, value any)
|
||||||
cavnasFinish()
|
canvasFinish()
|
||||||
canvasTextMetrics(htmlID, font, text string) TextMetrics
|
canvasTextMetrics(htmlID, font, text string) TextMetrics
|
||||||
htmlPropertyValue(htmlID, name string) string
|
htmlPropertyValue(htmlID, name string) string
|
||||||
handleAnswer(data DataObject)
|
handleAnswer(data DataObject)
|
||||||
|
@ -290,7 +290,11 @@ func (session *sessionData) writeInitScript(writer *strings.Builder) {
|
||||||
|
|
||||||
if session.rootView != nil {
|
if session.rootView != nil {
|
||||||
writer.WriteString(`document.getElementById('ruiRootView').innerHTML = '`)
|
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();")
|
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 {
|
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 {
|
if session.bridge != nil {
|
||||||
session.bridge.cavnasFinish()
|
session.bridge.canvasFinish()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -42,7 +42,7 @@ func viewByHTMLID(id string, startView View) View {
|
||||||
if startView.htmlID() == id {
|
if startView.htmlID() == id {
|
||||||
return startView
|
return startView
|
||||||
}
|
}
|
||||||
if container, ok := startView.(ParanetView); ok {
|
if container, ok := startView.(ParentView); ok {
|
||||||
for _, view := range container.Views() {
|
for _, view := range container.Views() {
|
||||||
if view != nil {
|
if view != nil {
|
||||||
if v := viewByHTMLID(id, view); v != nil {
|
if v := viewByHTMLID(id, view); v != nil {
|
||||||
|
|
|
@ -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
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -218,7 +218,7 @@ type CellIndex struct {
|
||||||
// TableView - text View
|
// TableView - text View
|
||||||
type TableView interface {
|
type TableView interface {
|
||||||
View
|
View
|
||||||
ParanetView
|
ParentView
|
||||||
ReloadTableData()
|
ReloadTableData()
|
||||||
CellFrame(row, column int) Frame
|
CellFrame(row, column int) Frame
|
||||||
|
|
||||||
|
|
|
@ -94,7 +94,7 @@ func GetTableSelectionMode(view View, subviewID ...string) int {
|
||||||
return enumStyledProperty(view, subviewID, SelectionMode, NoneSelection, false)
|
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)
|
// 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.
|
// 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 {
|
func GetTableVerticalAlign(view View, subviewID ...string) int {
|
||||||
|
|
2
view.go
2
view.go
|
@ -45,7 +45,7 @@ type View interface {
|
||||||
Focusable() bool
|
Focusable() bool
|
||||||
// Frame returns the location and size of the view in pixels
|
// Frame returns the location and size of the view in pixels
|
||||||
Frame() Frame
|
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
|
Scroll() Frame
|
||||||
// SetAnimated sets the value (second argument) of the property with name defined by the first argument.
|
// 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
|
// Return "true" if the value has been set, in the opposite case "false" are returned and
|
||||||
|
|
|
@ -12,7 +12,7 @@ func ViewByID(rootView View, id string) View {
|
||||||
return rootView
|
return rootView
|
||||||
}
|
}
|
||||||
|
|
||||||
if container, ok := rootView.(ParanetView); ok {
|
if container, ok := rootView.(ParentView); ok {
|
||||||
if view := viewByID(container, id); view != nil {
|
if view := viewByID(container, id); view != nil {
|
||||||
return view
|
return view
|
||||||
}
|
}
|
||||||
|
@ -32,13 +32,13 @@ func ViewByID(rootView View, id string) View {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func viewByID(rootView ParanetView, id string) View {
|
func viewByID(rootView ParentView, id string) View {
|
||||||
for _, view := range rootView.Views() {
|
for _, view := range rootView.Views() {
|
||||||
if view != nil {
|
if view != nil {
|
||||||
if view.ID() == id {
|
if view.ID() == id {
|
||||||
return view
|
return view
|
||||||
}
|
}
|
||||||
if container, ok := view.(ParanetView); ok {
|
if container, ok := view.(ParentView); ok {
|
||||||
if v := viewByID(container, id); v != nil {
|
if v := viewByID(container, id); v != nil {
|
||||||
return v
|
return v
|
||||||
}
|
}
|
||||||
|
|
|
@ -338,7 +338,7 @@ func (style *viewStyle) set(tag string, value any) bool {
|
||||||
return true
|
return true
|
||||||
|
|
||||||
case DataObject:
|
case DataObject:
|
||||||
if animation := parseAnimation(value); animation.hasAnimatedPropery() {
|
if animation := parseAnimation(value); animation.hasAnimatedProperty() {
|
||||||
style.properties[tag] = []Animation{animation}
|
style.properties[tag] = []Animation{animation}
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
@ -348,7 +348,7 @@ func (style *viewStyle) set(tag string, value any) bool {
|
||||||
result := true
|
result := true
|
||||||
for i := 0; i < value.ArraySize(); i++ {
|
for i := 0; i < value.ArraySize(); i++ {
|
||||||
if obj := value.ArrayElement(i).Object(); obj != nil {
|
if obj := value.ArrayElement(i).Object(); obj != nil {
|
||||||
if anim := parseAnimation(obj); anim.hasAnimatedPropery() {
|
if anim := parseAnimation(obj); anim.hasAnimatedProperty() {
|
||||||
animations = append(animations, anim)
|
animations = append(animations, anim)
|
||||||
} else {
|
} else {
|
||||||
result = false
|
result = false
|
||||||
|
|
|
@ -2,7 +2,7 @@ package rui
|
||||||
|
|
||||||
import "strings"
|
import "strings"
|
||||||
|
|
||||||
type ParanetView interface {
|
type ParentView interface {
|
||||||
// Views return a list of child views
|
// Views return a list of child views
|
||||||
Views() []View
|
Views() []View
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,7 @@ type ParanetView interface {
|
||||||
// ViewsContainer - mutable list-container of Views
|
// ViewsContainer - mutable list-container of Views
|
||||||
type ViewsContainer interface {
|
type ViewsContainer interface {
|
||||||
View
|
View
|
||||||
ParanetView
|
ParentView
|
||||||
// Append appends a view to the end of the list of a view children
|
// Append appends a view to the end of the list of a view children
|
||||||
Append(view View)
|
Append(view View)
|
||||||
// Insert inserts a view to the "index" position in the list of a view children
|
// Insert inserts a view to the "index" position in the list of a view children
|
||||||
|
|
|
@ -135,7 +135,7 @@ func (bridge *wasmBridge) clearAnimation() {
|
||||||
styles.Set("textContent", "")
|
styles.Set("textContent", "")
|
||||||
}
|
}
|
||||||
|
|
||||||
func (bridge *wasmBridge) cavnasStart(htmlID string) {
|
func (bridge *wasmBridge) canvasStart(htmlID string) {
|
||||||
if ProtocolInDebugLog {
|
if ProtocolInDebugLog {
|
||||||
DebugLog("const ctx = document.getElementById('" + htmlID + "'elementId').getContext('2d');\nctx.save();")
|
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() {
|
if !bridge.canvas.IsNull() {
|
||||||
DebugLog("ctx.restore()")
|
DebugLog("ctx.restore()")
|
||||||
bridge.canvas.Call("restore")
|
bridge.canvas.Call("restore")
|
||||||
|
|
|
@ -146,7 +146,7 @@ func (bridge *wsBridge) argToString(arg any) (string, bool) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ErrorLog("Unsupported agument type")
|
ErrorLog("Unsupported argument type")
|
||||||
return "", false
|
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.Reset()
|
||||||
bridge.canvasBuffer.WriteString(`const ctx = getCanvasContext('`)
|
bridge.canvasBuffer.WriteString(`const ctx = getCanvasContext('`)
|
||||||
bridge.canvasBuffer.WriteString(htmlID)
|
bridge.canvasBuffer.WriteString(htmlID)
|
||||||
|
@ -328,7 +328,7 @@ func (bridge *wsBridge) callCanvasImageFunc(url string, property string, funcNam
|
||||||
bridge.canvasBuffer.WriteString(");\n}")
|
bridge.canvasBuffer.WriteString(");\n}")
|
||||||
}
|
}
|
||||||
|
|
||||||
func (bridge *wsBridge) cavnasFinish() {
|
func (bridge *wsBridge) canvasFinish() {
|
||||||
bridge.canvasBuffer.WriteString("\n")
|
bridge.canvasBuffer.WriteString("\n")
|
||||||
script := bridge.canvasBuffer.String()
|
script := bridge.canvasBuffer.String()
|
||||||
if ProtocolInDebugLog {
|
if ProtocolInDebugLog {
|
||||||
|
|
Loading…
Reference in New Issue