Skip to content

Commit

Permalink
Fix: Works when orientation of item is set to top.
Browse files Browse the repository at this point in the history
  • Loading branch information
javdome committed Nov 7, 2023
1 parent 7df6fa7 commit 03e1bbb
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
11 changes: 8 additions & 3 deletions arrow.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
*
* Class to easily draw lines to connect items in the vis Timeline module.
*
* @version 4.1.0
* @date 2022-08-01
* @version 4.1.1
* @date 2023-11-07
*
* @copyright (c) Javi Domenech (javdome@gmail.com)
*
Expand Down Expand Up @@ -224,7 +224,12 @@ export default class Arrow {
//Función que recibe in Item y devuelve la posición en pantalla del item.
_getItemPos (item) {
let left_x = item.left;
let top_y = item.parent.top + item.parent.height - item.top - item.height;
let top_y;
if (this._timeline.options.orientation.item == "top") {
top_y = item.parent.top + item.top;
} else {
top_y = item.parent.top + item.parent.height - item.top - item.height;
}
return {
left: left_x,
top: top_y,
Expand Down
1 change: 1 addition & 0 deletions examples/basic_example.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
groupOrder: "content", // groupOrder can be a property name or a sorting function
selectable: true,
editable: true,
// orientation: "top",
groupTemplate: function(group) { //function to hide groups
var container = document.createElement('div');
var label = document.createElement('span');
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "timeline-arrows",
"version": "4.1.0",
"version": "4.1.1",
"description": "Package to easily draw lines to connect items in the vis Timeline module.",
"main": "arrow.js",
"scripts": {
Expand Down

0 comments on commit 03e1bbb

Please sign in to comment.