Skip to content
This repository has been archived by the owner on Jan 5, 2025. It is now read-only.

Commit

Permalink
fixed compatibility with material lib 1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
FDIM committed Aug 30, 2016
1 parent 84155af commit 7d7f621
Show file tree
Hide file tree
Showing 9 changed files with 43 additions and 21 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "mdRangeSlider",
"main": "dist/md-range-slider.js",
"version": "1.0.6",
"version": "1.0.7",
"homepage": "https://github.com/FDIM/ng-md-range-slider.git",
"authors": [
"FDIM <domas.trijonis@gmail.com>"
Expand Down
10 changes: 10 additions & 0 deletions dist/md-range-slider.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,12 @@
if(!$scope.step){
$scope.step = 1;
}
if(!$scope.minGap){
$scope.minGap = $scope.step;
}
$scope.$watchGroup(['min','max'],minMaxWatcher);
$scope.$watch('lowerValue',lowerValueWatcher);
$scope.$watch('upperValue',upperValueWatcher);

function minMaxWatcher() {
$scope.lowerMax = $scope.max - $scope.step;
Expand Down Expand Up @@ -36,6 +40,12 @@
updateWidth();
}

function upperValueWatcher() {
if($scope.upperValue <= $scope.lowerValue + $scope.step){
$scope.upperValue = $scope.lowerValue + $scope.step;
}
}

function updateWidth() {
$scope.upperWidth = ((($scope.max-($scope.lowerValue + $scope.step))/($scope.max-$scope.min)) * 100) + "%";
if($scope.lowerValue > ($scope.upperValue - $scope.minGap) && $scope.upperValue < $scope.max) {
Expand Down
2 changes: 1 addition & 1 deletion dist/md-range-slider.min.js

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

13 changes: 7 additions & 6 deletions dist/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@
.range-slider-left md-slider {
min-width: 0px;
}
.range-slider-left md-slider ._md-thumb-container {
.range-slider-left md-slider .md-thumb-container {
z-index: 10;
}
.range-slider-left md-slider ._md-track {
.range-slider-left md-slider .md-track {
background-color: #3d4450;
}
.range-slider-left md-slider ._md-track._md-track-fill {
.range-slider-left md-slider .md-track.md-track-fill {
background-color: #9e9e9e;
}
.range-slider-right {
Expand All @@ -28,13 +28,14 @@
.range-slider-right md-slider {
min-width: 0px;
}
.range-slider-right md-slider ._md-thumb-container {
.range-slider-right md-slider .md-thumb-container {
transition: -webkit-transform 0s linear;
transition: transform 0s linear;
}
.range-slider-right md-slider ._md-track-container ._md-track {
.range-slider-right md-slider .md-track-container .md-track {
background-color: #9e9e9e;
}
.range-slider-right md-slider ._md-track-container ._md-track._md-track-fill {
.range-slider-right md-slider .md-track-container .md-track.md-track-fill {
background-color: #3d4450;
transition: none;
}
2 changes: 1 addition & 1 deletion dist/style.min.css

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

6 changes: 3 additions & 3 deletions example/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ <h3>Filter by price</h3>
<div style="width:300px;margin:auto;" ng-controller="App2Controller">
<h3>Filter by age</h3>
<p>Selected range: {{lower}}-{{upper}}</p>
<range-slider lower-value="lower" upper-value="upper" min-gap="1" step="1" min="min" max="max" ></range-slider>
<range-slider lower-value="lower" upper-value="upper" min-gap="2" step="2" min="min" max="max" ></range-slider>
<input type="number" placeholder="Min" ng-model="min"/>
<input type="number" placeholder="Max" ng-model="max"/>
</div>
Expand All @@ -37,8 +37,8 @@ <h3>Filter by age</h3>
$scope.lower = $scope.min;
$scope.upper = $scope.max;
}]);

angular.bootstrap(document, ['example']);
</script>
</body>
</html>
</html>
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mdRangeSlider",
"version": "1.0.6",
"version": "1.0.7",
"main": "dist/md-range-slider.js",
"scripts": {
"test": "gulp coverage"
Expand Down
10 changes: 10 additions & 0 deletions src/module.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,12 @@
if(!$scope.step){
$scope.step = 1;
}
if(!$scope.minGap){
$scope.minGap = $scope.step;
}
$scope.$watchGroup(['min','max'],minMaxWatcher);
$scope.$watch('lowerValue',lowerValueWatcher);
$scope.$watch('upperValue',upperValueWatcher);

function minMaxWatcher() {
$scope.lowerMax = $scope.max - $scope.step;
Expand Down Expand Up @@ -36,6 +40,12 @@
updateWidth();
}

function upperValueWatcher() {
if($scope.upperValue <= $scope.lowerValue + $scope.step){
$scope.upperValue = $scope.lowerValue + $scope.step;
}
}

function updateWidth() {
$scope.upperWidth = ((($scope.max-($scope.lowerValue + $scope.step))/($scope.max-$scope.min)) * 100) + "%";
if($scope.lowerValue > ($scope.upperValue - $scope.minGap) && $scope.upperValue < $scope.max) {
Expand Down
17 changes: 9 additions & 8 deletions src/style.less
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@
width:100%;
md-slider{
min-width: 0px;
._md-thumb-container{
.md-thumb-container{
z-index: 10;
}
._md-track{
.md-track{
background-color: @range-slider-highlight;
&._md-track-fill{
&.md-track-fill{
background-color: @range-slider-bg;
}
}
Expand All @@ -32,17 +32,18 @@
md-slider{
min-width: 0px;
// Overwrite specific to range adaptation
._md-thumb-container {
.md-thumb-container {
transition: -webkit-transform 0s linear;
transition: transform 0s linear;
}
._md-track-container{
._md-track{
.md-track-container{
.md-track{
background-color: @range-slider-bg;
&._md-track-fill{
&.md-track-fill{
background-color: @range-slider-highlight;
transition: none;
}
}
}
}
}
}

0 comments on commit 7d7f621

Please sign in to comment.