Skip to content

Commit 2c25c2e

Browse files
committed
Slider emit event on mousedown version 1.1.7
1 parent 99b0733 commit 2c25c2e

File tree

3 files changed

+14
-8
lines changed

3 files changed

+14
-8
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@impvis/components",
3-
"version": "1.1.6",
3+
"version": "1.1.7",
44
"license": "BSD-3-Clause",
55
"main": "./dist/impvis-components.js",
66
"unpkg": "./dist/impvis-components.umd.js",

src/components/Slider/Slider.vue

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
<template>
22
<div ref="sliderContainer">
3-
<resize-observer @notify="update_step" />
43
<div class = "sliderGroup">
54
<iv-bubble v-if="bubble" :sliderValue="value" :min="min" :max="max" :thumb_width="thumb_width" :value_marker_width="value_marker_width" :colorBubble="color.dark"/>
6-
<input type="range" :style="cssColor" :class="[(playSlider)? 'iv-range-play' : 'iv-range']" v-model.number="value" :min="min" :max="max" :step="step" @change="emitSlider">
5+
<input type="range" :style="cssColor" :class="[(playSlider)? 'iv-range-play' : 'iv-range']" v-model.number="value" :min="min" :max="max" :step="step" @mousedown="startDrag" @mousemove="emitSlider" @mouseup="stopDrag">
76
<iv-line-ticks v-if="lineTick" :sliderTicksList="tick_list" :thumb_width="thumb_width" :min="min" :max="max" :key="tick_line_key" />
87
<iv-num-ticks v-if="numTick" :sliderTicksList="tick_list" :thumb_width="thumb_width" :min="min" :max="max" :key="tick_num_key"/>
98
</div>
@@ -92,6 +91,7 @@ export default {
9291
tick_list: null,
9392
tick_line_key: null,
9493
tick_num_key: null,
94+
dragging: false,
9595
value_marker_width: 25,//same as the width of the marker showing the value
9696
thumb_width: 18,//same as the width of the range slider thumb
9797
}
@@ -109,9 +109,17 @@ export default {
109109
console.log(tick_list)
110110
return tick_list
111111
},
112+
startDrag(){
113+
this.dragging = true;
114+
},
112115
emitSlider(){
113-
this.$emit("sliderChanged",this.value);
114-
}
116+
if (this.dragging){
117+
this.$emit("sliderChanged",this.value);
118+
}
119+
},
120+
stopDrag(){
121+
this.dragging = false;
122+
},
115123
},
116124
computed:{
117125
cssColor(){
@@ -128,9 +136,6 @@ export default {
128136
this.tick_num_key = "tick_num_" + this._uid;
129137
},
130138
watch:{
131-
step:{
132-
handler:"update_step"
133-
},
134139
current_step:function(){
135140
this.tick_list = this.calc_ticks();
136141
},

src/components/Tabs/Tabs.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ export default {
3939
this.tabs[i].isActive = i === selectedTabIndex;
4040
if(i === selectedTabIndex){
4141
this.tabActivated = this.tabs[i].tabName + i + " is opened";
42+
this.$emit("tabSelected", this.tabs[i].tabName)
4243
}
4344
}
4445
},

0 commit comments

Comments
 (0)