Commit ab2f405f authored by Siong-Ui Te's avatar Siong-Ui Te

update state machine current word and index while mouse enter

parent f643bf2b
......@@ -12,6 +12,7 @@ var st *StateMachine
type StateMachine struct {
Input *Object
CurrentIndex int
CurrentWord string
}
func (s *StateMachine) HandleArrowUp() {
......@@ -30,6 +31,12 @@ func (s *StateMachine) HandleEnter() {
}
}
func SetStateMachineCurrentIndexAndWord(i int, word string) {
st.CurrentIndex = i
st.CurrentWord = word
SetInputValue(word)
}
func (s *StateMachine) HandleDefault() {
word := GetInputValue()
SetModalWords(GetSuggestedWordsHtml(word, 7))
......
......@@ -53,8 +53,7 @@ func possibleWordClickHandler(word string) {
}
func possibleWordMouseenterHandler(i int, word string) {
SetInputValue(word)
//println(i)
SetStateMachineCurrentIndexAndWord(i, word)
}
func GetSuggestedWordsHtml(word string, limit int) string {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment