force cursor on drag'n'drop of timeline elements (#5886)

[ci skip]
pull/5889/head
Roman Roelofsen 7 years ago committed by Oliver Günther
parent 34a92da62b
commit 70da4c93e7
  1. 4
      frontend/app/components/wp-table/timeline/cells/timeline-cell-renderer.ts
  2. 26
      frontend/app/components/wp-table/timeline/cells/wp-timeline-cell-mouse-handler.ts
  3. 18
      frontend/app/components/wp-table/timeline/container/wp-timeline-container.directive.ts

@ -158,14 +158,14 @@ export class TimelineCellRenderer {
if (jQuery(ev.target).hasClass(classNameLeftHandle)) {
// only left
direction = 'left';
this.workPackageTimeline.forceCursor('ew-resize');
this.workPackageTimeline.forceCursor('col-resize');
if (changeset.value('startDate') === null) {
changeset.setValue('startDate', changeset.value('dueDate'));
}
} else if (jQuery(ev.target).hasClass(classNameRightHandle) || dateForCreate) {
// only right
direction = 'right';
this.workPackageTimeline.forceCursor('ew-resize');
this.workPackageTimeline.forceCursor('col-resize');
if (changeset.value('dueDate') === null) {
changeset.setValue('dueDate', changeset.value('startDate'));
}

@ -48,18 +48,18 @@ export const classNameRightHandle = 'rightHandle';
export const classNameBarLabel = 'bar-label';
export function registerWorkPackageMouseHandler(this: void,
getRenderInfo: () => RenderInfo,
workPackageTimeline: WorkPackageTimelineTableController,
wpCacheService: WorkPackageCacheService,
wpTableRefresh: WorkPackageTableRefreshService,
wpNotificationsService: WorkPackageNotificationService,
loadingIndicator: LoadingIndicatorService,
cell: HTMLElement,
bar: HTMLDivElement,
export function registerWorkPackageMouseHandler(this:void,
getRenderInfo:() => RenderInfo,
workPackageTimeline:WorkPackageTimelineTableController,
wpCacheService:WorkPackageCacheService,
wpTableRefresh:WorkPackageTableRefreshService,
wpNotificationsService:WorkPackageNotificationService,
loadingIndicator:LoadingIndicatorService,
cell:HTMLElement,
bar:HTMLDivElement,
labels:WorkPackageCellLabels,
renderer: TimelineCellRenderer,
renderInfo: RenderInfo) {
renderer:TimelineCellRenderer,
renderInfo:RenderInfo) {
let mouseDownStartDay:number | null = null; // also flag to signal active drag'n'drop
renderInfo.changeset = new WorkPackageChangeset(renderInfo.workPackage);
@ -79,7 +79,7 @@ export function registerWorkPackageMouseHandler(this: void,
// handles initial creation of start/due values
cell.onmousemove = handleMouseMoveOnEmptyCell;
function applyDateValues(renderInfo:RenderInfo, dates:{[name:string]: Moment}) {
function applyDateValues(renderInfo:RenderInfo, dates:{ [name:string]:Moment }) {
// Let the renderer decide which fields we change
renderer.assignDateValues(renderInfo.changeset, labels, dates);
}
@ -127,7 +127,7 @@ export function registerWorkPackageMouseHandler(this: void,
dateStates = renderer.onDaysMoved(renderInfo.changeset, dayUnderCursor, days, direction);
applyDateValues(renderInfo, dateStates);
renderer.update(bar, labels, renderInfo);
}
};
}
function keyPressFn(ev:JQueryEventObject) {

@ -282,19 +282,19 @@ export class WorkPackageTimelineTableController {
}
forceCursor(cursor:string) {
// TODO not working
jQuery('.' + timelineElementCssClass).css('cursor', cursor + ' !important');
jQuery('.hascontextmenu').css('cursor', cursor + ' !important');
jQuery('.' + timelineElementCssClass).css('cursor', cursor);
jQuery('.wp-timeline-cell').css('cursor', cursor);
jQuery('.hascontextmenu').css('cursor', cursor);
jQuery('.leftHandle').css('cursor', cursor);
jQuery('.rightHandle').css('cursor', cursor);
}
resetCursor() {
// TODO not working
jQuery('.' + timelineElementCssClass).css('cursor', '');
jQuery('.hascontextmenu').css('cursor', 'context-menu');
// jQuery('.' + classNameLeftHandle).css('cursor', '');
// jQuery('.' + classNameBar).css('cursor', '');
// jQuery('.' + classNameRightHandle).css('cursor', '');
jQuery('.wp-timeline-cell').css('cursor', '');
jQuery('.hascontextmenu').css('cursor', '');
jQuery('.leftHandle').css('cursor', '');
jQuery('.rightHandle').css('cursor', '');
}
private resetSelectionMode() {

Loading…
Cancel
Save