Skip to content

Commit 6466459

Browse files
mikolaj.kocotmikolaj.kocot
authored andcommitted
prevent user interaction within highlighted area
preventEvents parameter
1 parent 77d2fc8 commit 6466459

File tree

1 file changed

+28
-16
lines changed

1 file changed

+28
-16
lines changed

enjoyhint.js

Lines changed: 28 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
onEnd: function() {},
3131

3232
onSkip: function() {},
33-
33+
3434
onNext: function() {}
3535
};
3636

@@ -292,7 +292,8 @@
292292
left: step_data.left,
293293
right: step_data.right,
294294
margin: step_data.margin,
295-
scroll: step_data.scroll
295+
scroll: step_data.scroll,
296+
preventEvents: step_data.preventEvents
296297
};
297298

298299
var customBtnProps = {
@@ -1103,16 +1104,27 @@
11031104
.appendTo(that.enjoyhint);
11041105
};
11051106

1106-
that.disableEventsNearRect = function(rect) {
1107+
that.disableEventsNearRect = function(rect, alsoDisableRect) {
1108+
var top = rect.top;
1109+
var left = rect.left;
1110+
var right = rect.right;
1111+
var bottom = rect.bottom;
1112+
1113+
//to disable events also within highlighted rectable, simply remove the gap
1114+
if (alsoDisableRect === true) {
1115+
top = bottom;
1116+
right = left;
1117+
}
1118+
11071119
$top_dis_events
1108-
.css({
1109-
top: "0",
1110-
left: "0"
1111-
})
1112-
.height(rect.top);
1120+
.css({
1121+
top: "0",
1122+
left: "0"
1123+
})
1124+
.height(top);
11131125

11141126
$bottom_dis_events.css({
1115-
top: rect.bottom + "px",
1127+
top: bottom + "px",
11161128
left: "0"
11171129
});
11181130

@@ -1121,11 +1133,11 @@
11211133
top: "0",
11221134
left: 0 + "px"
11231135
})
1124-
.width(rect.left);
1136+
.width(left);
11251137

11261138
$right_dis_events.css({
11271139
top: "0",
1128-
left: rect.right + "px"
1140+
left: right + "px"
11291141
});
11301142
};
11311143

@@ -1437,10 +1449,10 @@
14371449
else {
14381450
distance = initial_distance;
14391451
ver_button_position = initial_ver_position;
1440-
that.$next_btn.html(customBtnProps.nextButton && customBtnProps.nextButton.text ?
1441-
customBtnProps.nextButton.text : 'Next');
1442-
that.$prev_btn.html(customBtnProps.prevButton && customBtnProps.prevButton.text ?
1443-
customBtnProps.prevButton.text : 'Previous');
1452+
that.$next_btn.html(customBtnProps.nextButton && customBtnProps.nextButton.text ?
1453+
customBtnProps.nextButton.text : 'Next');
1454+
that.$prev_btn.html(customBtnProps.prevButton && customBtnProps.prevButton.text ?
1455+
customBtnProps.prevButton.text : 'Previous');
14441456
}
14451457

14461458
that.$prev_btn.css({
@@ -1481,7 +1493,7 @@
14811493
bottom: shape_data.bottom,
14821494
left: shape_data.left,
14831495
right: shape_data.right
1484-
});
1496+
}, data.preventEvents);
14851497

14861498
that.renderArrow({
14871499
x_from: x_from,

0 commit comments

Comments
 (0)