Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
purescript-gargantext
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Grégoire Locqueville
purescript-gargantext
Commits
f8e96c7d
Commit
f8e96c7d
authored
Sep 13, 2019
by
Przemyslaw Kaminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Graph] rangeslider fixes for mouse move
Propagate changes correctly when knob is dragged.
parent
0a60b1bd
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
5 deletions
+8
-5
RangeSlider.purs
src/Gargantext/Components/RangeSlider.purs
+8
-5
No files found.
src/Gargantext/Components/RangeSlider.purs
View file @
f8e96c7d
...
...
@@ -13,6 +13,7 @@ import Data.Nullable (Nullable, null, toMaybe)
import Data.Traversable (traverse_)
import Data.Tuple.Nested ((/\))
import DOM.Simple as DOM
import DOM.Simple.Console (log2)
import DOM.Simple.Document (document)
import DOM.Simple.Element as Element
import DOM.Simple.Event as Event
...
...
@@ -99,9 +100,10 @@ rangeSliderCpt = R.hooksComponent "RangeSlider" cpt
case reproject drag scalePos props.bounds props.epsilon (R2.domMousePosition event) of
Just val -> do
setKnob knob setValue value val
props.onChange $ knobSetter knob value val
Nothing -> destroy unit
let onMouseUp = EL.callback $ \(_event :: Event.MouseEvent) -> do
props.onChange value
--props.onChange $ knobSetter knob value val
setDragKnob $ const Nothing
destroy unit
EL.addEventListener document "mousemove" onMouseMove
...
...
@@ -129,10 +131,11 @@ destroyEventHandler name ref = traverse_ destroy $ R.readRef ref
R.setRef ref Nothing
setKnob :: Knob -> R2.StateSetter Range.NumberRange -> Range.NumberRange -> Number -> Effect Unit
setKnob knob setValue r val = setValue $ const $ setter knob r val
where
setter MinKnob = Range.withMin
setter MaxKnob = Range.withMax
setKnob knob setValue r val = setValue $ const $ knobSetter knob r val
knobSetter :: Knob -> Range.NumberRange -> Number -> Range.NumberRange
knobSetter MinKnob = Range.withMin
knobSetter MaxKnob = Range.withMax
getDragScale :: Knob -> Maybe DOMRect -> Maybe DOMRect -> Maybe DOMRect -> Maybe Range.NumberRange
getDragScale knob scalePos lowPos highPos = do
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment