This repository was archived by the owner on Jan 4, 2021. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +3
-14
lines changed Expand file tree Collapse file tree 1 file changed +3
-14
lines changed Original file line number Diff line number Diff line change 72
72
< template >
73
73
< div class ="resultField " hidden ="[[ displayResultZone(hideresult, unloaded) ]] ">
74
74
< template is ="dom-repeat " id ="candidateList " items ="[[ candidates ]] " as ="candidate ">
75
- < span id ="candidate " class ="candidate " index =" [[ index ]] " selected$ ="[[ candidate.selected ]] "
75
+ < span id ="candidate " class ="candidate " selected$ ="[[ _isSelected(index, result.textSegmentResult.selectedCandidateIdx) ]] "
76
76
inner-h-t-m-l ="[[ candidate.customlabel ]] " on-tap ="_select "> </ span >
77
77
</ template >
78
78
</ div >
164
164
myscriptTextWebElement . result = eventDetail . rawResult . result ;
165
165
myscriptTextWebElement . resultlabel = eventDetail . rawResult . result . textSegmentResult . candidates [ eventDetail . rawResult . result . textSegmentResult . selectedCandidateIdx ] . label ;
166
166
myscriptTextWebElement . candidates = eventDetail . rawResult . result . textSegmentResult . candidates ;
167
- myscriptTextWebElement . candidates [ eventDetail . rawResult . result . textSegmentResult . selectedCandidateIdx ] . selected = true ; // FIXME: ugly hack to mark selected candidate
168
167
textUpdateCandidatesCustomLabel ( myscriptTextWebElement ) ;
169
168
}
170
169
}
761
760
this . result = { } ;
762
761
this . result = result ;
763
762
} ,
764
- /**
765
- * Determine if the candidate is selected
766
- * @param candidate
767
- * @param result
768
- * @returns {boolean }
769
- * @private
770
- */
771
- _isSelected : function ( candidate , result ) {
772
- if ( result && result . textSegmentResult ) {
773
- return ( candidate === result . textSegmentResult . candidates [ result . textSegmentResult . selectedCandidateIdx ] ) ;
774
- }
775
- return false ;
763
+ _isSelected : function ( index , selectedIndex ) {
764
+ return index === selectedIndex ;
776
765
} ,
777
766
_getChildSegments : function ( candidate , result , type ) {
778
767
var segments = [ ] ;
You can’t perform that action at this time.
0 commit comments