Skip to content

Commit

Permalink
Add feature to change popup trigger event (#77)
Browse files Browse the repository at this point in the history
* Add change-popup-mode

* Add feature to change popup trigger event

* Remove example of change_popup_mode from index

* Revert back to the original build files

* Make changes asked in review

* Remove default to click from bind event as default already set

* code formatting
  • Loading branch information
anto-christo authored and netchampfaris committed May 23, 2018
1 parent 98f38e1 commit 0c39cc9
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
1 change: 0 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ <h2>Interactive Gantt Chart entirely made in SVG!</h2>
custom_class: 'bar-milestone'
},
]

var gantt_chart = new Gantt(".gantt-target", tasks, {
on_click: function (task) {
console.log(task);
Expand Down
4 changes: 2 additions & 2 deletions src/bar.js
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ export default class Bar {
}

setup_click_event() {
$.on(this.group, 'focus click', e => {
$.on(this.group, 'focus ' + this.gantt.options.popup_trigger, e => {
if (this.action_completed) {
// just finished a move action, wait for a few seconds
return;
Expand All @@ -184,7 +184,7 @@ export default class Bar {
if (e.type === 'click') {
this.gantt.trigger_event('click', [this.task]);
}

this.gantt.unselect_all();
this.group.classList.toggle('active');

Expand Down
3 changes: 2 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ export default class Gantt {
padding: 18,
view_mode: 'Day',
date_format: 'YYYY-MM-DD',
popup_trigger: 'click',
custom_popup_html: null
};
this.options = Object.assign({}, default_options, options);
Expand Down Expand Up @@ -571,7 +572,7 @@ export default class Gantt {
}

bind_grid_click() {
$.on(this.$svg, 'click', '.grid-row, .grid-header', () => {
$.on(this.$svg, this.options.popup_trigger, '.grid-row, .grid-header', () => {
this.unselect_all();
this.hide_popup();
});
Expand Down

0 comments on commit 0c39cc9

Please sign in to comment.