some improvements

Former-commit-id: 28a0d10367
This commit is contained in:
Roman Volosovskyi 2016-06-25 21:30:43 +03:00
parent 4ed06ff622
commit e4309050b3
2 changed files with 13 additions and 13 deletions

View File

@ -305,9 +305,8 @@
(commands/unstage-command db staged-command))) (commands/unstage-command db staged-command)))
(register-handler :set-chat-command (register-handler :set-chat-command
[(after #(dispatch [:command-edit-mode])) [(after invoke-suggestions-handler!)
;(after #(dispatch [:animate-show-response])) (after #(dispatch [:command-edit-mode]))]
]
(fn [db [_ command-key]] (fn [db [_ command-key]]
(commands/set-chat-command db command-key))) (commands/set-chat-command db command-key)))

View File

@ -16,11 +16,11 @@
(register-handler name [(path :animations) middleware] handler))) (register-handler name [(path :animations) middleware] handler)))
(animation-handler :animate-cancel-command (animation-handler :animate-cancel-command
(after #(dispatch [:text-edit-mode])) (after #(dispatch [:text-edit-mode]))
(fn [db _] (fn [db _]
(assoc db (assoc db
:to-response-height input-height :to-response-height input-height
:messages-offset? false))) :messages-offset? false)))
(def response-height (+ input-height response-height-normal)) (def response-height (+ input-height response-height-normal))
@ -41,12 +41,14 @@
(if (and suggestions? (not= 0.1 current)) (if (and suggestions? (not= 0.1 current))
identity inc)))))) identity inc))))))
(animation-handler :animate-show-response (register-handler :animate-show-response
[(after #(dispatch [:command-edit-mode]))] [(after #(dispatch [:command-edit-mode]))]
(fn [db] (fn [{:keys [current-chat-id] :as db}]
(assoc db :messages-offset? true (let [suggestions? (seq (get-in db [:suggestions current-chat-id]))
height (if suggestions? middle-height minimum-suggestion-height)]
(update db :animations assoc :messages-offset? true
:messages-offset-max request-info-height :messages-offset-max request-info-height
:to-response-height response-height))) :to-response-height height))))
(defn fix-height (defn fix-height
[height-key height-signal-key suggestions-key minimum] [height-key height-signal-key suggestions-key minimum]
@ -72,7 +74,6 @@
(and under-middle-position? (and under-middle-position?
moving-down?) moving-down?)
minimum)] minimum)]
(println height-key new-fixed)
(-> db (-> db
(assoc-in [:animations height-key] new-fixed) (assoc-in [:animations height-key] new-fixed)
(update-in [:animations height-signal-key] inc))))) (update-in [:animations height-signal-key] inc)))))