Skip to content

Commit 7335cea

Browse files
AndVikVinavasuro
authored andcommitted
Fixed: buttons position issue xbsoftware#71
1 parent 1a04dae commit 7335cea

File tree

1 file changed

+26
-13
lines changed

1 file changed

+26
-13
lines changed

src/jquery.enjoyhint.js

Lines changed: 26 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -681,6 +681,8 @@ CanvasRenderingContext2D.prototype.roundRect = function(x, y, w, h, r) {
681681
};
682682
};
683683

684+
var arrowFinishX;
685+
684686
that.renderArrow = function(data) {
685687
var x_from = data.x_from || 0;
686688
var y_from = data.y_from || 0;
@@ -713,9 +715,11 @@ CanvasRenderingContext2D.prototype.roundRect = function(x, y, w, h, r) {
713715
var text = data.text || "";
714716
that.enjoyhint.addClass(that.cl.svg_transparent);
715717

718+
arrowFinishX = x_to;
719+
716720
setTimeout(function() {
717721
$("#enjoyhint_arrpw_line").remove();
718-
722+
719723
var d =
720724
"M" +
721725
x_from +
@@ -952,21 +956,30 @@ CanvasRenderingContext2D.prototype.roundRect = function(x, y, w, h, r) {
952956
text: data.text
953957
});
954958

955-
that.$next_btn.css({
956-
left: label_x,
957-
top: label_y + label_height + 20
958-
});
959+
setTimeout(function(){
960+
var summoryButtonWidth = that.$next_btn.width() + that.$skip_btn.width() + 10;
961+
var distance = label_x;
959962

960-
var left_skip = label_x + that.$next_btn.width() + 10;
963+
if (summoryButtonWidth + label_x > arrowFinishX) {
964+
distance = label_x + label_width/2 + 20;
965+
}
961966

962-
if (that.nextBtn == "hide") {
963-
left_skip = label_x;
964-
}
967+
that.$next_btn.css({
968+
left: distance,
969+
top: label_y + label_height + 20
970+
});
965971

966-
that.$skip_btn.css({
967-
left: left_skip,
968-
top: label_y + label_height + 20
969-
});
972+
var left_skip = distance + that.$next_btn.width() + 10;
973+
974+
if (that.nextBtn == "hide") {
975+
left_skip = distance;
976+
}
977+
978+
that.$skip_btn.css({
979+
left: left_skip,
980+
top: label_y + label_height + 20
981+
});
982+
}, 0)
970983

971984
that.$close_btn.css({
972985
right: 10,

0 commit comments

Comments
 (0)