Browse Source

Rename timeline option 'allDraggable' to 'itemsAlwaysDraggable' and update documentation

fixDataView
Liuqing Chen 9 years ago
parent
commit
5009adca92
3 changed files with 13 additions and 5 deletions
  1. +8
    -0
      docs/timeline/index.html
  2. +4
    -4
      lib/timeline/component/ItemSet.js
  3. +1
    -1
      lib/timeline/optionsTimeline.js

+ 8
- 0
docs/timeline/index.html View File

@ -666,6 +666,14 @@ function (option, path) {
and set repeat to weekly. and set repeat to weekly.
</td> </td>
</tr> </tr>
<tr>
<td>itemsAlwaysDraggable</td>
<td>boolean</td>
<td><code>false</code></td>
<td>If true, all items in the Timeline are draggable without being selected. If false, only the selected item(s) are draggable.</td>
</tr>
<tr> <tr>
<td>locale</td> <td>locale</td>
<td>String</td> <td>String</td>

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

@ -43,7 +43,7 @@ function ItemSet(body, options) {
selectable: true, selectable: true,
multiselect: false, multiselect: false,
allDraggable: false,
itemsAlwaysDraggable: false,
editable: { editable: {
updateTime: false, updateTime: false,
@ -308,7 +308,7 @@ ItemSet.prototype._create = function(){
ItemSet.prototype.setOptions = function(options) { ItemSet.prototype.setOptions = function(options) {
if (options) { if (options) {
// copy all options that we know // copy all options that we know
var fields = ['type', 'align', 'order', 'stack', 'selectable', 'multiselect', 'allDraggable', 'multiselectPerGroup', 'groupOrder', 'dataAttributes', 'template', 'groupTemplate', 'hide', 'snap', 'groupOrderSwap'];
var fields = ['type', 'align', 'order', 'stack', 'selectable', 'multiselect', 'itemsAlwaysDraggable', 'multiselectPerGroup', 'groupOrder', 'dataAttributes', 'template', 'groupTemplate', 'hide', 'snap', 'groupOrderSwap'];
util.selectiveExtend(fields, this.options, options); util.selectiveExtend(fields, this.options, options);
if ('orientation' in options) { if ('orientation' in options) {
@ -1173,7 +1173,7 @@ ItemSet.prototype._onDragStart = function (event) {
var me = this; var me = this;
var props; var props;
if (item && (item.selected || this.options.allDraggable)) {
if (item && (item.selected || this.options.itemsAlwaysDraggable)) {
if (!this.options.editable.updateTime && if (!this.options.editable.updateTime &&
!this.options.editable.updateGroup && !this.options.editable.updateGroup &&
@ -1214,7 +1214,7 @@ ItemSet.prototype._onDragStart = function (event) {
var baseGroupIndex = this._getGroupIndex(item.data.group); var baseGroupIndex = this._getGroupIndex(item.data.group);
var itemsToDrag = (this.options.allDraggable && !item.selected) ? [item.id] : this.getSelection();
var itemsToDrag = (this.options.itemsAlwaysDraggable && !item.selected) ? [item.id] : this.getSelection();
this.touchParams.itemProps = itemsToDrag.map(function (id) { this.touchParams.itemProps = itemsToDrag.map(function (id) {
var item = me.items[id]; var item = me.items[id];

+ 1
- 1
lib/timeline/optionsTimeline.js View File

@ -26,7 +26,6 @@ let allOptions = {
//globals : //globals :
align: {string}, align: {string},
allDraggable: { boolean: boolean },
autoResize: {boolean}, autoResize: {boolean},
throttleRedraw: {number}, throttleRedraw: {number},
clickToUse: {boolean}, clickToUse: {boolean},
@ -80,6 +79,7 @@ let allOptions = {
repeat: {string}, repeat: {string},
__type__: {object, array} __type__: {object, array}
}, },
itemsAlwaysDraggable: { boolean: boolean },
locale:{string}, locale:{string},
locales:{ locales:{
__type__: {object} __type__: {object}

Loading…
Cancel
Save