@@ -7,6 +7,7 @@ class MapProperties {
7
7
this . mapModes = [ "Linear" , "Expression" ] ;
8
8
this . mapProtocols = [ "UDP" , "TCP" ] ;
9
9
this . boundaryIcons = [ "none" , "right" , "left" , "mute" , "clamp" , "wrap" ] ;
10
+ this . cachedProperty = { "key" : null , "value" : null } ;
10
11
11
12
$ ( this . container ) . append (
12
13
"<div' class='topMenu' id='mapPropsContainer' style='width:calc(100% - 605px);'>" +
@@ -74,12 +75,17 @@ class MapProperties {
74
75
75
76
// The range input handler
76
77
$ ( '#mapPropsContainer' ) . on ( {
77
- keydown : function ( e ) {
78
+ keydown : function ( e ) { e . stopPropagation ( ) ; } ,
79
+ keyup : function ( e ) {
78
80
e . stopPropagation ( ) ;
79
81
if ( e . which == 13 || e . which == 9 ) { //'enter' or 'tab' key
80
82
self . setMapProperty ( $ ( this ) . attr ( 'id' ) . split ( ' ' ) [ 0 ] ,
81
83
this . value ) ;
82
84
}
85
+ else {
86
+ self . cacheMapProperty ( $ ( this ) . attr ( 'id' ) . split ( ' ' ) [ 0 ] ,
87
+ this . value ) ;
88
+ }
83
89
} ,
84
90
click : function ( e ) { e . stopPropagation ( ) ; } ,
85
91
focusout : function ( e ) {
@@ -91,19 +97,27 @@ class MapProperties {
91
97
92
98
// The expression input handler
93
99
$ ( '#mapPropsContainer' ) . on ( {
94
- keydown : function ( e ) {
100
+ keydown : function ( e ) { e . stopPropagation ( ) ; } ,
101
+ keyup : function ( e ) {
95
102
e . stopPropagation ( ) ;
96
103
if ( e . which == 13 ) { //'enter' key
97
- if ( counter >= 1 ) {
104
+ // check if expression contains a semicolon
105
+ if ( this . value . indexOf ( ';' ) == - 1 || counter >= 1 ) {
98
106
self . setMapProperty ( $ ( this ) . attr ( 'id' ) . split ( ' ' ) [ 0 ] ,
99
107
this . value ) ;
100
- counter = 0 ;
108
+ counter = 0 ;
101
109
}
102
- else
110
+ else {
103
111
counter += 1 ;
112
+ self . cacheMapProperty ( $ ( this ) . attr ( 'id' ) . split ( ' ' ) [ 0 ] ,
113
+ this . value ) ;
114
+ }
104
115
}
105
- else
116
+ else {
106
117
counter = 0 ;
118
+ self . cacheMapProperty ( $ ( this ) . attr ( 'id' ) . split ( ' ' ) [ 0 ] ,
119
+ this . value ) ;
120
+ }
107
121
} ,
108
122
click : function ( e ) { e . stopPropagation ( ) ; } ,
109
123
focusout : function ( e ) {
@@ -344,8 +358,19 @@ class MapProperties {
344
358
this . updateMapProperties ( ) ;
345
359
}
346
360
361
+ cacheMapProperty ( key , value ) {
362
+ this . cachedProperty . key = key ;
363
+ this . cachedProperty . value = value ;
364
+ }
365
+
366
+ sendCachedProperty ( ) {
367
+ if ( ! this . cachedProperty . key || ! this . cachedProperty . value )
368
+ return ;
369
+ this . setMapProperty ( this . cachedProperty . key , this . cachedProperty . value ) ;
370
+ }
371
+
347
372
setMapProperty ( key , value ) {
348
- let container = $ ( this . container ) ;
373
+ this . cacheMapProperty ( ) ;
349
374
let modes = this . mapModeCommands ;
350
375
this . database . maps . filter ( this . selected ) . forEach ( function ( map ) {
351
376
if ( map [ key ] && ( map [ key ] == value || map [ key ] == parseFloat ( value ) ) )
0 commit comments