Files
nspanel-lovelace-ui/HMI/n2t-out/pageSwipeTest.txt

574 lines
24 KiB
Plaintext

Page pageSwipeTest
Attributes
ID : 0
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
Opacity : 127
Width : 480
Effect : load
Effect Priority : 0
Effect Time : 300
Locked : no
Swide up page ID : disabled
Swide down page ID : disabled
Swide left page ID : disabled
Swide right page ID : disabled
Fill : solid color
Back. Color : 65535
Number nXS
Attributes
ID : 7
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
Opacity : 127
x coordinate : 130
y coordinate : 20
Width : 100
Height : 30
Effect : load
Effect Priority : 0
Effect Time : 300
Fill : solid color
Style : flat
Associated Keyboard : none
Font ID : 4
Back. Color : 65535
Font Color : 0
Horizontal Alignment : center
Vertical Alignment : center
Value : 0
Significant digits shown : all
Format : decimal
Word wrap : enabled
Horizontal Spacing : 0
Vertical Spacing : 0
Number nYE
Attributes
ID : 8
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
Opacity : 127
x coordinate : 128
y coordinate : 111
Width : 100
Height : 30
Effect : load
Effect Priority : 0
Effect Time : 300
Fill : solid color
Style : flat
Associated Keyboard : none
Font ID : 4
Back. Color : 65535
Font Color : 0
Horizontal Alignment : center
Vertical Alignment : center
Value : 0
Significant digits shown : all
Format : decimal
Word wrap : enabled
Horizontal Spacing : 0
Vertical Spacing : 0
Number nYS
Attributes
ID : 9
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
Opacity : 127
x coordinate : 134
y coordinate : 77
Width : 100
Height : 30
Effect : load
Effect Priority : 0
Effect Time : 300
Fill : solid color
Style : flat
Associated Keyboard : none
Font ID : 4
Back. Color : 65535
Font Color : 0
Horizontal Alignment : center
Vertical Alignment : center
Value : 0
Significant digits shown : all
Format : decimal
Word wrap : enabled
Horizontal Spacing : 0
Vertical Spacing : 0
Number nXE
Attributes
ID : 10
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
Opacity : 127
x coordinate : 132
y coordinate : 48
Width : 100
Height : 30
Effect : load
Effect Priority : 0
Effect Time : 300
Fill : solid color
Style : flat
Associated Keyboard : none
Font ID : 4
Back. Color : 65535
Font Color : 0
Horizontal Alignment : center
Vertical Alignment : center
Value : 0
Significant digits shown : all
Format : decimal
Word wrap : enabled
Horizontal Spacing : 0
Vertical Spacing : 0
Number nYR
Attributes
ID : 12
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
Opacity : 127
x coordinate : 315
y coordinate : 101
Width : 100
Height : 30
Effect : load
Effect Priority : 0
Effect Time : 300
Fill : solid color
Style : flat
Associated Keyboard : none
Font ID : 4
Back. Color : 65535
Font Color : 0
Horizontal Alignment : center
Vertical Alignment : center
Value : 0
Significant digits shown : all
Format : decimal
Word wrap : enabled
Horizontal Spacing : 0
Vertical Spacing : 0
Number nXR
Attributes
ID : 13
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
Opacity : 127
x coordinate : 315
y coordinate : 73
Width : 100
Height : 30
Effect : load
Effect Priority : 0
Effect Time : 300
Fill : solid color
Style : flat
Associated Keyboard : none
Font ID : 4
Back. Color : 65535
Font Color : 0
Horizontal Alignment : center
Vertical Alignment : center
Value : 0
Significant digits shown : all
Format : decimal
Word wrap : enabled
Horizontal Spacing : 0
Vertical Spacing : 0
Text tDesc1
Attributes
ID : 2
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
Opacity : 127
x coordinate : 4
y coordinate : 2
Width : 152
Height : 164
Effect : load
Effect Priority : 0
Effect Time : 300
Fill : solid color
Style : flat
Associated Keyboard : none
Font ID : 4
Back. Color : 65535
Font Color : 0
Horizontal Alignment : center
Vertical Alignment : center
Input Type : character
Text : X-Start:\r\nX-End:\r\nY-Start:\r\nY-End:
Max. Text Size : 70
Word wrap : disabled
Horizontal Spacing : 0
Vertical Spacing : 0
Text t2
Attributes
ID : 3
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
Opacity : 127
x coordinate : 4
y coordinate : 152
Width : 152
Height : 62
Effect : load
Effect Priority : 0
Effect Time : 300
Fill : solid color
Style : flat
Associated Keyboard : none
Font ID : 4
Back. Color : 65535
Font Color : 0
Horizontal Alignment : center
Vertical Alignment : center
Input Type : character
Text : Swipe Dir\r\nold:
Max. Text Size : 70
Word wrap : disabled
Horizontal Spacing : 0
Vertical Spacing : 0
Text tDirection
Attributes
ID : 6
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
Opacity : 127
x coordinate : 93
y coordinate : 183
Width : 100
Height : 29
Effect : load
Effect Priority : 0
Effect Time : 300
Fill : solid color
Style : flat
Associated Keyboard : none
Font ID : 4
Back. Color : 65535
Font Color : 0
Horizontal Alignment : center
Vertical Alignment : center
Input Type : character
Text : newtxt
Max. Text Size : 10
Word wrap : disabled
Horizontal Spacing : 0
Vertical Spacing : 0
Text t0
Attributes
ID : 11
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
Opacity : 127
x coordinate : 259
y coordinate : 5
Width : 171
Height : 129
Effect : load
Effect Priority : 0
Effect Time : 300
Fill : solid color
Style : flat
Associated Keyboard : none
Font ID : 4
Back. Color : 65535
Font Color : 0
Horizontal Alignment : center
Vertical Alignment : center
Input Type : character
Text : Difference\r\n\r\nX\r\nY
Max. Text Size : 60
Word wrap : disabled
Horizontal Spacing : 0
Vertical Spacing : 0
Text tStatusNew
Attributes
ID : 14
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
Opacity : 127
x coordinate : 216
y coordinate : 240
Width : 162
Height : 33
Effect : load
Effect Priority : 0
Effect Time : 300
Fill : solid color
Style : flat
Associated Keyboard : none
Font ID : 4
Back. Color : 65535
Font Color : 0
Horizontal Alignment : center
Vertical Alignment : center
Input Type : character
Text : newtxt
Max. Text Size : 40
Word wrap : enabled
Horizontal Spacing : 0
Vertical Spacing : 0
Text t3
Attributes
ID : 15
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
Opacity : 127
x coordinate : 9
y coordinate : 242
Width : 203
Height : 65
Effect : load
Effect Priority : 0
Effect Time : 300
Fill : solid color
Style : flat
Associated Keyboard : none
Font ID : 4
Back. Color : 65535
Font Color : 0
Horizontal Alignment : center
Vertical Alignment : center
Input Type : character
Text : new status:\r\nnew direction:
Max. Text Size : 50
Word wrap : disabled
Horizontal Spacing : 0
Vertical Spacing : 0
Text tDirNew
Attributes
ID : 16
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
Opacity : 127
x coordinate : 218
y coordinate : 272
Width : 162
Height : 33
Effect : load
Effect Priority : 0
Effect Time : 300
Fill : solid color
Style : flat
Associated Keyboard : none
Font ID : 4
Back. Color : 65535
Font Color : 0
Horizontal Alignment : center
Vertical Alignment : center
Input Type : character
Text : newtxt
Max. Text Size : 40
Word wrap : enabled
Horizontal Spacing : 0
Vertical Spacing : 0
Picture p0
Attributes
ID : 1
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
Opacity : 127
x coordinate : 0
y coordinate : 0
Width : 479
Height : 319
Effect : load
Effect Priority : 0
Effect Time : 300
Picture ID : 0
Button b8
Attributes
ID : 17
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
Opacity : 127
x coordinate : 326
y coordinate : 158
Width : 107
Height : 50
Effect : load
Effect Priority : 0
Effect Time : 300
Fill : solid color
Style : 3D auto
Font ID : 4
Back. Color : 50712
Back. Picture ID (Pressed) : 65535
Back. Color (Pressed) : 1024
Font Color (Unpressed) : 0
Font Color (Pressed) : 65535
Horizontal Alignment : center
Vertical Alignment : center
State : unpressed
Text : back
Max. Text Size : 10
Word wrap : disabled
Horizontal Spacing : 0
Vertical Spacing : 0
Events
Touch Press Event
page pageTest
Timer tm0
Attributes
ID : 5
Scope : local
Period (ms): 50
Enabled : yes
Events
Timer Event
if(tc0.val!=0)
{
xc2=tch0
yc2=tch1
//debug
nXE.val=xc2
nYE.val=yc2
}
TouchCap tc0
Attributes
ID : 4
Scope: local
Value: 0
Events
Touch Press Event
if(tc0.val==9) // This is the location of the brightness slider
{
xc1=0
yc1=0
}else
{
xc1=tch0
yc1=tch1
//debug
nXS.val=xc1
nYS.val=yc1
tm0.en=1
}
Touch Release Event
tm0.en=0
if(tc0.val==9) // This is the location of the brightness slider
{
}else
{
if(tch0==0)
// When this is zero we can interpret that as the real end of the drag event
{
xcR=xc1-xc2
ycR=yc1-yc2
// //debug
// nXR.val=xcR
// nYR.val=ycR
// if(xcR>125)
// {
// tDirection.txt="left"
// }else if(xcR<-125)
// {
// tDirection.txt="right"
// }else if(ycR>125)
// {
// tDirection.txt="up"
// }else if(ycR<-125)
// {
// tDirection.txt="down"
// }else
// {
// tDirection.txt="invalid"
// }
// new method
// one of the difference values should be low to be a valid direction, in case it has a high value it's not a valid swipe, because it's diagonal
// x difference between -125 and 125 (swipe on y-axis)
if(xcR>ixLimit&&xcR<xLimit)
{
tStatusNew.txt="x low, -> y"
// check if below minimum value (change is negative)
if(ycR<iyLimitMin)
{
tDirNew.txt="down"
}else if(ycR>yLimitMin)
{
tDirNew.txt="up"
}else
{
tDirNew.txt="invalid"
}
// y difference between -125 and 125 (swipe on x-axis)
}else if(ycR>iyLimit&&ycR<yLimit)
{
tStatusNew.txt="y low, -> x"
if(xcR<ixLimitMin)
{
tDirNew.txt="right"
}else if(xcR>xLimitMin)
{
tDirNew.txt="left"
}else
{
tDirNew.txt="invalid"
}
//diagonal swipe invalid
}else
{
tStatusNew.txt="invalid"
tDirNew.txt="diagonal"
}
}
}