Skip to content
Open
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
18 changes: 16 additions & 2 deletions demo-app/src/demo.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ export default class DemoTimeline extends Component {
message: '',
timelineMode: TIMELINE_MODES.SELECT | TIMELINE_MODES.DRAG | TIMELINE_MODES.RESIZE,
useTable: true,
useMoment: true
useMoment: true,
allowVerticalDrag: false
};
this.reRender = this.reRender.bind(this);
this.zoomIn = this.zoomIn.bind(this);
Expand All @@ -63,6 +64,7 @@ export default class DemoTimeline extends Component {
this.toggleResizable = this.toggleResizable.bind(this);
this.toggleUseMoment = this.toggleUseMoment.bind(this);
this.toggleUseTable = this.toggleUseTable.bind(this);
this.toggleVerticalDrag = this.toggleVerticalDrag.bind(this);
}

componentWillMount() {
Expand Down Expand Up @@ -166,6 +168,11 @@ export default class DemoTimeline extends Component {
this.setState({useTable: !useTable});
}

toggleVerticalDrag() {
const {allowVerticalDrag} = this.state;
this.setState({allowVerticalDrag: !allowVerticalDrag});
}

handleItemClick = (e, key) => {
const message = `Item Click ${key}`;
const {selectedItems} = this.state;
Expand Down Expand Up @@ -288,7 +295,8 @@ export default class DemoTimeline extends Component {
useCustomRenderers,
timelineMode,
useMoment,
useTable
useTable,
allowVerticalDrag
} = this.state;
const rangeValue = [startDate, endDate];
const minMaxRangeValue = [minDate, maxDate];
Expand Down Expand Up @@ -402,6 +410,11 @@ export default class DemoTimeline extends Component {
Use table
</Checkbox>
</Form.Item>
<Form.Item>
<Checkbox onChange={this.toggleVerticalDrag} checked={allowVerticalDrag}>
Alow vertical drag
</Checkbox>
</Form.Item>
</Form>
<div>
<span>Debug: </span>
Expand Down Expand Up @@ -466,6 +479,7 @@ export default class DemoTimeline extends Component {
onRowContextClick={this.handleRowContextClick}
onRowDoubleClick={this.handleRowDoubleClick}
itemRenderer={useCustomRenderers ? CustomItemRenderer : ItemRenderer}
allowSegmentVerticalDragFunction={(_) => allowVerticalDrag}
/>
</div>
);
Expand Down
8 changes: 7 additions & 1 deletion src/timeline.js
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,12 @@ export default class Timeline extends React.Component {
*
* @type { undefined | boolean}
*/
showZommShortcuts: PropTypes.bool
showZommShortcuts: PropTypes.bool,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

atentie greseala de scriere


/**
* @type {undefined | (selectedItems: (number | string)[]) => boolean}
*/
allowSegmentVerticalDragFunction: PropTypes.func

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

deocamdata nu am o idee finala; vad insa neconcordante:

1/ nici o functie nu are "segment". Cateva au "onItem..."
2/ in afara de zIndexFunction, nici una nu se numeste cu ...Function. Majoritatea sunt on...
3/ nici una nu prea ia ca param selectia. Unele iau Item
4/ de vazut daca o faceem tot in stilul displayItemOnSeparateRowIfOverlap, adica boolean sau function. Sau mereu function.

};

static defaultProps = {
Expand Down Expand Up @@ -1401,6 +1406,7 @@ export default class Timeline extends React.Component {
let animatedItems = this._gridDomNode.querySelectorAll("span[isDragging='True'") || [];

let dx = (parseFloat(target.getAttribute('drag-x')) || 0) + e.dx;
// this is location for calculate the new dy using allowSegmentVerticalDragFunction function
let dy = (parseFloat(target.getAttribute('drag-y')) || 0) + e.dy;
let selections = [];

Expand Down