Skip to content

Commit d2e9ed0

Browse files
committed
add on_focus method to slider to do things on focus events
1 parent 0c6c5ba commit d2e9ed0

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ bower_components
44
*.pyc
55
.DS_Store
66
/venv
7+
/.venv
78
__pycache__/
89
*~
910
/.vscode/

lib/glow/primitives.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3381,7 +3381,7 @@
33813381
var cvs = canvas.get_selected()
33823382
var attrs = {pos:cvs.caption_anchor, aria_label:"", aria_labelledby:"", aria_describedby:"", length:400, width:10, vertical:false, disabled:false,
33833383
min:0, max:1, align:'none', top:0, right:0, bottom:0, left:0, range_color:vec(0,0,0),
3384-
handle_color:vec(0, 0x6c/0xff, 0xfa/0xff)}
3384+
handle_color:vec(0, 0x6c/0xff, 0xfa/0xff), on_focus:undefined}
33853385
if (args.bind !== undefined) {
33863386
attrs.bind = args.bind
33873387
delete args.bind
@@ -3484,7 +3484,11 @@
34843484
if (attrs.aria_describedby) {
34853485
$( `#${attrs._id} .ui-slider-handle`).attr('aria-describedby', attrs.aria_describedby._id)
34863486
}
3487-
3487+
3488+
if (attrs.on_focus) {
3489+
$(`#${attrs._id} .ui-slider-handle`).on('focus',attrs.on_focus)
3490+
}
3491+
34883492
var cslider = {
34893493
get disabled() {return attrs.disabled},
34903494
set disabled(value) {

0 commit comments

Comments
 (0)