Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.DS_Store
node_modules
bower_components
.idea
8 changes: 8 additions & 0 deletions .idea/angular-multirange-slider.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 14 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

443 changes: 443 additions & 0 deletions .idea/workspace.xml

Large diffs are not rendered by default.

6 changes: 1 addition & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,4 @@ For reference, the resulting markup from the first example:
</div>
</div>
</div>
```

Todo
------
* Touch events
```
34 changes: 34 additions & 0 deletions dist/multirange-slider.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,38 @@ sliderHandleDirective = function($document) {
});
startX = 0;
startPleft = startPright = 0;
element.on('touchstart', function(event) {
var ref, touchend, touchmove;
if (nextRange() == null) {
return;
}
touchmove = function(event) {
return scope.$apply(function() {
var dp, ref;
console.log('TouchMove: ');
console.log(event);
dp = (event.touches[0].clientX - startX) / slider.elementWidth() * slider.pTotal();
if (dp < -startPleft || dp > startPright) {
return;
}
range.value(startPleft + dp);
if ((ref = nextRange()) != null) {
ref.value(startPright - dp);
}
return slider.updateRangeWidths();
});
};
touchend = function() {
$document.unbind('touchmove', touchmove);
return $document.unbind('touchend', touchend);
};
event.preventDefault();
startX = event.touches[0].clientX;
startPleft = range.value();
startPright = (ref = nextRange()) != null ? ref.value() : void 0;
$document.on('touchmove', touchmove);
return $document.on('touchend', touchend);
});
return element.on('mousedown', function(event) {
var mousemove, mouseup, ref;
if (nextRange() == null) {
Expand All @@ -157,6 +189,8 @@ sliderHandleDirective = function($document) {
mousemove = function(event) {
return scope.$apply(function() {
var dp, ref;
console.log('MouseMove: ');
console.log(event);
dp = (event.screenX - startX) / slider.elementWidth() * slider.pTotal();
if (dp < -startPleft || dp > startPright) {
return;
Expand Down
12 changes: 7 additions & 5 deletions gulpfile.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,24 @@ gulp.task "clean", ->
#
# Compile coffescript
#
gulp.task "coffee", [], ->
gulp.task "coffee", ->
gulp.src(SRC_DIR + "/**/*.coffee")
.pipe coffee({bare: true}).on('error', gutil.log)
.pipe gulp.dest(BUILD_DIR)

#
# Build task
#
gulp.task "build", ["clean"], ->
gulp.start('coffee')
gulp.task "build", gulp.series(["clean"], ->
gulp.task('coffee')()
gulp.src([SRC_DIR + "/**/*.css", SRC_DIR + "/**/*.html"])
.pipe gulp.dest(BUILD_DIR)
)


#
# Watch task
#
gulp.task "watch", ["build"], ->
gulp.watch "src/**/*.*", ["build"]
gulp.task "watch", gulp.series(["build"], ->
gulp.watch "src/**/*.*", gulp.series("build")
)
Loading