Skip to content
This repository has been archived by the owner on Nov 19, 2019. It is now read-only.

Add ability to disable fit on cluster double click #125

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions docs/src/OptionsPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -693,6 +693,12 @@ class OptionsPage extends React.Component {
<td><code>{`false`}</code></td>
<td>If true, line from cluster to time axis is displayed when content overflows.</td>
</tr>
<tr parent="cluster">
<td className="indent">cluster.fitOnDoubleClick</td>
<td>boolean</td>
<td><code>{`true`}</code></td>
<td>If true, the cluster will be centered on double click.</td>
</tr>

<tr>
<td>snap</td>
Expand Down
2 changes: 1 addition & 1 deletion examples/other/clustering.html
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@
var clusterOpts = {
cluster: {
titleTemplate: "Cluster containing {count} events. Zoom in to see the individual events.",
showStipes: true
showStipes: true,
}
};
Object.assign(options, defaultOptions, clusterOpts);
Expand Down
10 changes: 5 additions & 5 deletions lib/timeline/component/item/ClusterItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,7 @@ class ClusterItem extends Item {
},
};

this.options = Object.assign({}, options, {
editable: false
});
this.options = Object.assign({}, {fitOnDoubleClick: true}, options, {editable: false});

if (!data || data.uiItems == undefined) {
throw new Error('Property "uiItems" missing in item ' + data.id);
Expand Down Expand Up @@ -379,8 +377,10 @@ class ClusterItem extends Item {
this.dom.dot.style.display = 'none';
}

this.dom.box.ondblclick = ClusterItem.prototype._onDoubleClick.bind(this);

if (this.options.fitOnDoubleClick) {
this.dom.box.ondblclick = ClusterItem.prototype._onDoubleClick.bind(this);
}

// attach this item as attribute
this.dom.box['timeline-item'] = this;

Expand Down
1 change: 1 addition & 0 deletions lib/timeline/optionsTimeline.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ let allOptions = {
titleTemplate: {'string': string, 'undefined': 'undefined'},
clusterCriteria: { 'function': 'function', 'undefined': 'undefined'},
showStipes: {'boolean': bool, 'undefined': 'undefined'},
fitOnDoubleClick: {'boolean': bool, 'undefined': 'undefined'},
__type__: {'boolean': bool, object}
},
snap: {'function': 'function', 'null': 'null'},
Expand Down