Browse Source

Fixed #877: Added support for metaKey to select multiple items.

flowchartTest
jos 9 years ago
parent
commit
626d4b9b8b
6 changed files with 8 additions and 7 deletions
  1. +2
    -1
      HISTORY.md
  2. +1
    -1
      examples/network/other/manipulation.html
  3. +0
    -1
      examples/timeline/editing/editingItemsCallbacks.html
  4. +2
    -1
      lib/network/modules/InteractionHandler.js
  5. +2
    -2
      lib/timeline/component/ItemSet.js
  6. +1
    -1
      lib/util.js

+ 2
- 1
HISTORY.md View File

@ -26,7 +26,8 @@ http://visjs.org
### Graph2d & Timeline ### Graph2d & Timeline
- Fixed #858, #872, fixed usage of deprecated `unsubscribe` from DataSet. - Fixed #858, #872, fixed usage of deprecated `unsubscribe` from DataSet.
- Fixed #869: add className with id to custom time bars
- Fixed #869: Add className with id to custom time bars
- Fixed #877: Added support for metaKey to select multiple items.
## 2015-05-22, version 4.0.0 ## 2015-05-22, version 4.0.0

+ 1
- 1
examples/network/other/manipulation.html View File

@ -1,7 +1,7 @@
<!doctype html> <!doctype html>
<html> <html>
<head> <head>
<title>Network | Localization</title>
<title>Network | Manipulation</title>
<style type="text/css"> <style type="text/css">
body, select { body, select {

+ 0
- 1
examples/timeline/editing/editingItemsCallbacks.html View File

@ -127,7 +127,6 @@
} }
function prettyPrompt(title, text, inputValue, callback) { function prettyPrompt(title, text, inputValue, callback) {
console.log(title, text, inputValue)
swal({ swal({
title: title, title: title,
text: text, text: text,

+ 2
- 1
lib/network/modules/InteractionHandler.js View File

@ -115,7 +115,8 @@ class InteractionHandler {
*/ */
onTap(event) { onTap(event) {
let pointer = this.getPointer(event.center); let pointer = this.getPointer(event.center);
let multiselect = this.selectionHandler.options.multiselect && event.changedPointers[0].ctrlKey;
let multiselect = this.selectionHandler.options.multiselect &&
(event.changedPointers[0].ctrlKey || event.changedPointers[0].metaKey);
this.checkSelectionChanges(pointer, event, multiselect); this.checkSelectionChanges(pointer, event, multiselect);
this.selectionHandler._generateClickEvent('click', event, pointer); this.selectionHandler._generateClickEvent('click', event, pointer);

+ 2
- 2
lib/timeline/component/ItemSet.js View File

@ -1163,7 +1163,7 @@ ItemSet.prototype._onDragStart = function (event) {
event.stopPropagation(); event.stopPropagation();
} }
else if (this.options.editable.add && event.srcEvent.ctrlKey) {
else if (this.options.editable.add && (event.srcEvent.ctrlKey || event.srcEvent.metaKey)) {
// create a new range item when dragging with ctrl key down // create a new range item when dragging with ctrl key down
this._onDragStartAddItem(event); this._onDragStartAddItem(event);
} }
@ -1386,7 +1386,7 @@ ItemSet.prototype._onDragEnd = function (event) {
ItemSet.prototype._onSelectItem = function (event) { ItemSet.prototype._onSelectItem = function (event) {
if (!this.options.selectable) return; if (!this.options.selectable) return;
var ctrlKey = event.srcEvent && event.srcEvent.ctrlKey;
var ctrlKey = event.srcEvent && (event.srcEvent.ctrlKey || event.srcEvent.metaKey);
var shiftKey = event.srcEvent && event.srcEvent.shiftKey; var shiftKey = event.srcEvent && event.srcEvent.shiftKey;
if (ctrlKey || shiftKey) { if (ctrlKey || shiftKey) {
this._onMultiSelectItem(event); this._onMultiSelectItem(event);

+ 1
- 1
lib/util.js View File

@ -1390,4 +1390,4 @@ exports.easingFunctions = {
easeInOutQuint: function (t) { easeInOutQuint: function (t) {
return t < .5 ? 16 * t * t * t * t * t : 1 + 16 * (--t) * t * t * t * t return t < .5 ? 16 * t * t * t * t * t : 1 + 16 * (--t) * t * t * t * t
} }
};
};

Loading…
Cancel
Save