Browse Source

fix delete btn and remove console.logs

codeClimate
Yotam Berkowitz 8 years ago
parent
commit
885ebffbce
8 changed files with 47 additions and 12 deletions
  1. +11
    -0
      dist/vis.css
  2. +12
    -5
      dist/vis.js
  3. +1
    -1
      dist/vis.min.css
  4. +0
    -1
      examples/timeline/groups/groupsEditable.html
  5. +6
    -1
      lib/network/modules/ManipulationSystem.js
  6. +0
    -3
      lib/timeline/component/ItemSet.js
  7. +11
    -0
      lib/timeline/component/css/item.css
  8. +6
    -1
      lib/timeline/component/item/Item.js

+ 11
- 0
dist/vis.css View File

@ -565,6 +565,17 @@ input.vis-configuration.vis-config-range:focus::-ms-fill-upper {
cursor: pointer;
}
.vis-item .vis-delete-rtl {
background: url('img/timeline/delete.png') no-repeat center;
position: absolute;
width: 24px;
height: 24px;
top: -4px;
left: -24px;
cursor: pointer;
}
.vis-item.vis-range .vis-drag-left {
position: absolute;
width: 24px;

+ 12
- 5
dist/vis.js View File

@ -19460,7 +19460,6 @@ return /******/ (function(modules) { // webpackBootstrap
if (group) {
itemData.group = group.groupId;
}
console.log("adding range item");
var newItem = new RangeItem(itemData, this.conversion, this.options);
newItem.id = id; // TODO: not so nice setting id afterwards
newItem.data = this._cloneItemData(itemData);
@ -19617,7 +19616,6 @@ return /******/ (function(modules) { // webpackBootstrap
}.bind(this));
this.stackDirty = true; // force re-stacking of all items next redraw
console.log("should redraw");
this.body.emitter.emit('_change');
}
};
@ -19921,7 +19919,6 @@ return /******/ (function(modules) { // webpackBootstrap
});
} else {
// add item
console.log("adding item");
if (this.options.rtl) {
var xAbs = util.getAbsoluteRight(this.dom.frame);
var x = xAbs - event.center.x;
@ -22111,7 +22108,12 @@ return /******/ (function(modules) { // webpackBootstrap
var me = this;
var deleteButton = document.createElement('div');
deleteButton.className = 'vis-delete';
if (this.options.rtl) {
deleteButton.className = 'vis-delete-rtl';
} else {
deleteButton.className = 'vis-delete';
}
deleteButton.title = 'Delete this item';
// TODO: be able to destroy the delete button
@ -43089,7 +43091,12 @@ return /******/ (function(modules) { // webpackBootstrap
}, {
key: '_createDeleteButton',
value: function _createDeleteButton(locale) {
var button = this._createButton('delete', 'vis-button vis-delete', locale['del'] || this.options.locales['en']['del']);
if (this.options.rtl) {
var deleteBtnClass = 'vis-button vis-delete-rtl';
} else {
var deleteBtnClass = 'vis-button vis-delete';
}
var button = this._createButton('delete', deleteBtnClass, locale['del'] || this.options.locales['en']['del']);
this.manipulationDiv.appendChild(button);
this._bindHammerToDiv(button, this.deleteSelected.bind(this));
}

+ 1
- 1
dist/vis.min.css
File diff suppressed because it is too large
View File


+ 0
- 1
examples/timeline/groups/groupsEditable.html View File

@ -299,7 +299,6 @@
a.value = b.value;
b.value = v;
},
rtl: true,
orientation: 'both',
editable: true,
groupEditable: true,

+ 6
- 1
lib/network/modules/ManipulationSystem.js View File

@ -689,7 +689,12 @@ class ManipulationSystem {
}
_createDeleteButton(locale) {
let button = this._createButton('delete', 'vis-button vis-delete', locale['del'] || this.options.locales['en']['del']);
if (this.options.rtl) {
var deleteBtnClass = 'vis-button vis-delete-rtl';
} else {
var deleteBtnClass = 'vis-button vis-delete';
}
let button = this._createButton('delete', deleteBtnClass, locale['del'] || this.options.locales['en']['del']);
this.manipulationDiv.appendChild(button);
this._bindHammerToDiv(button, this.deleteSelected.bind(this));
}

+ 0
- 3
lib/timeline/component/ItemSet.js View File

@ -1295,7 +1295,6 @@ ItemSet.prototype._onDragStartAddItem = function (event) {
if (group) {
itemData.group = group.groupId;
}
console.log("adding range item");
var newItem = new RangeItem(itemData, this.conversion, this.options);
newItem.id = id; // TODO: not so nice setting id afterwards
newItem.data = this._cloneItemData(itemData);
@ -1459,7 +1458,6 @@ ItemSet.prototype._onDrag = function (event) {
}.bind(this));
this.stackDirty = true; // force re-stacking of all items next redraw
console.log("should redraw");
this.body.emitter.emit('_change');
}
};
@ -1771,7 +1769,6 @@ ItemSet.prototype._onAddItem = function (event) {
}
else {
// add item
console.log("adding item");
if (this.options.rtl) {
var xAbs = util.getAbsoluteRight(this.dom.frame);
var x = xAbs - event.center.x;

+ 11
- 0
lib/timeline/component/css/item.css View File

@ -100,6 +100,17 @@
cursor: pointer;
}
.vis-item .vis-delete-rtl {
background: url('img/timeline/delete.png') no-repeat center;
position: absolute;
width: 24px;
height: 24px;
top: -4px;
left: -24px;
cursor: pointer;
}
.vis-item.vis-range .vis-drag-left {
position: absolute;
width: 24px;

+ 6
- 1
lib/timeline/component/item/Item.js View File

@ -155,7 +155,12 @@ Item.prototype._repaintDeleteButton = function (anchor) {
var me = this;
var deleteButton = document.createElement('div');
deleteButton.className = 'vis-delete';
if (this.options.rtl) {
deleteButton.className = 'vis-delete-rtl';
} else {
deleteButton.className = 'vis-delete';
}
deleteButton.title = 'Delete this item';
// TODO: be able to destroy the delete button

Loading…
Cancel
Save