Skip to content

Commit f383915

Browse files
authored
Merge pull request #144 from xbsoftware/AZ_fixes
AZ fixes
2 parents dbc1f26 + 39bca44 commit f383915

File tree

4 files changed

+33
-11
lines changed

4 files changed

+33
-11
lines changed

enjoyhint.js

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,12 @@
281281
scroll: step_data.scroll
282282
};
283283

284+
if (shape_data.center_x === 0 && shape_data.center_y === 0) {
285+
$body.enjoyhint("hide");
286+
destroyEnjoy();
287+
return console.log("Error: Element position couldn't be reached");
288+
}
289+
284290
if (step_data.shape && step_data.shape == "circle") {
285291
shape_data.shape = "circle";
286292
shape_data.radius = radius;
@@ -379,6 +385,8 @@
379385
case "skip":
380386
skipAll();
381387
break;
388+
389+
default: $body.trigger(makeEventName(event_name, true));
382390
}
383391
};
384392

@@ -1212,8 +1220,8 @@
12121220
var left_offset = data.center_x - half_w;
12131221
var right_offset = body_size.w - (data.center_x + half_w);
12141222

1215-
var label_shift = 150;
1216-
var label_margin = 40;
1223+
var label_shift = window.innerHeight < 670 ? 130 : 150;
1224+
var label_margin = window.innerHeight < 670 ? 0 : 40;
12171225
var label_shift_with_label_height =
12181226
label_shift + label_height + label_margin;
12191227
var label_ver_offset = half_h + label_shift;
@@ -1229,7 +1237,7 @@
12291237
{name: 'center_bottom', common_area: window.innerWidth * bottom_offset, width: window.innerWidth, height: bottom_offset},
12301238
];
12311239
var label_horizontal_space_required = label_width;
1232-
var label_vertical_space_required = label_shift_with_label_height + 20;
1240+
var label_vertical_space_required = window.innerHeight <= 670 ? label_shift_with_label_height : label_shift_with_label_height + 20;
12331241

12341242
var areas_priority = areas_for_label
12351243
.sort(function(area1, area2){return area1.common_area - area2.common_area})
@@ -1246,8 +1254,11 @@
12461254
}
12471255
}
12481256

1249-
var data_width_size = data.width ? data.width : data.radius * 2;
1250-
var data_height_size = data.height ? data.height : data.radius * 2;
1257+
var data_width_size = data.shape === "circle" ? data.radius * 2 :
1258+
data.width ? data.width : data.radius * 2;
1259+
1260+
var data_height_size = data.shape === "circle" ? data.radius * 2 :
1261+
data.height ? data.height : data.radius * 2;
12511262

12521263
var right_position = data.center_x + data_width_size/2 + 80;
12531264
var left_position = data.center_x - label_width - data_width_size/2 - 80;

0 commit comments

Comments
 (0)