diff options
author | Adrian Egloff | 2019-12-11 08:29:48 +0000 |
---|---|---|
committer | Adrian Egloff | 2019-12-18 09:10:14 +0000 |
commit | 79f44251158c8f6f93fa2551dff064a7cbfe7457 (patch) | |
tree | 19bee21878220ea26132d9b30425e3694b98929d | |
parent | c43debfe2472a68f743a4a1fbf5a82774d6b2630 (diff) | |
download | org.eclipse.scout.rt-79f44251158c8f6f93fa2551dff064a7cbfe7457.tar.gz org.eclipse.scout.rt-79f44251158c8f6f93fa2551dff064a7cbfe7457.tar.xz org.eclipse.scout.rt-79f44251158c8f6f93fa2551dff064a7cbfe7457.zip |
Remove workaround to stop click-event propagation
Not needed anymore and this change ensures that the day is also selected
if a child element of the day is clicked.
-rw-r--r-- | eclipse-scout-core/src/calendar/Calendar.js | 10 | ||||
-rw-r--r-- | eclipse-scout-core/src/calendar/CalendarComponent.js | 58 |
2 files changed, 34 insertions, 34 deletions
diff --git a/eclipse-scout-core/src/calendar/Calendar.js b/eclipse-scout-core/src/calendar/Calendar.js index f4cd7f6e4b..fd754806d8 100644 --- a/eclipse-scout-core/src/calendar/Calendar.js +++ b/eclipse-scout-core/src/calendar/Calendar.js @@ -448,14 +448,8 @@ export default class Calendar extends Widget { } _onDayMouseDown(event) { - // we cannot use event.stopPropagation() in CalendarComponent.js because this would - // prevent context-menus from being closed. With this awkward if-statement we only - // process the event, when it is not bubbling up from somewhere else (= from mousedown - // event on component). - if (event.eventPhase === Event.AT_TARGET) { - var selectedDate = $(event.delegateTarget).data('date'); - this._setSelection(selectedDate, null); - } + var selectedDate = $(event.delegateTarget).data('date'); + this._setSelection(selectedDate, null); } /** diff --git a/eclipse-scout-core/src/calendar/CalendarComponent.js b/eclipse-scout-core/src/calendar/CalendarComponent.js index 5084a3fe59..a752585f3a 100644 --- a/eclipse-scout-core/src/calendar/CalendarComponent.js +++ b/eclipse-scout-core/src/calendar/CalendarComponent.js @@ -240,32 +240,38 @@ export default class CalendarComponent extends Widget { var $part = $(event.delegateTarget); this.parent._selectedComponentChanged(this, $part.data('partDay')); - var popup = scout.create('WidgetPopup', { - parent: this.parent, - $anchor: $part, - closeOnAnchorMouseDown: true, - closeOnMouseDownOutside: true, - closeOnOtherPopupOpen: true, - horizontalAlignment: Popup.Alignment.LEFT, - verticalAlignment: Popup.Alignment.CENTER, - trimWidth: false, - trimHeight: false, - horizontalSwitch: true, - verticalSwitch: true, - withArrow: true, - cssClass: 'tooltip', - scrollType: 'remove', - location: { - y: event.originalEvent.y - }, - widget: { - objectType: 'Label', - htmlEnabled: true, - cssClass: 'tooltip-content', - value: this._description() - } - }); - popup.open(); + + if (event.button === 0) { + var popup = scout.create('WidgetPopup', { + parent: this.parent, + $anchor: $part, + closeOnAnchorMouseDown: true, + closeOnMouseDownOutside: true, + closeOnOtherPopupOpen: true, + horizontalAlignment: Popup.Alignment.LEFT, + verticalAlignment: Popup.Alignment.CENTER, + trimWidth: false, + trimHeight: false, + horizontalSwitch: true, + verticalSwitch: true, + withArrow: true, + cssClass: 'tooltip', + scrollType: 'remove', + location: { + y: event.originalEvent.y + }, + widget: { + objectType: 'Label', + htmlEnabled: true, + cssClass: 'tooltip-content', + value: this._description() + } + }); + popup.open(); + } + + // stop propagation to avoid fire mouse-down event on calendar-day (Calendar#_onDayMouseDown) + event.stopPropagation(); } _onContextMenu(event) { |