diff --git a/src/app/shared/shared.module.ts b/src/app/shared/shared.module.ts index 202a4b0c23..c78c218fa9 100644 --- a/src/app/shared/shared.module.ts +++ b/src/app/shared/shared.module.ts @@ -40,6 +40,7 @@ import { SearchResultGridElementComponent } from './object-grid/search-result-gr import { ViewModeSwitchComponent } from './view-mode-switch/view-mode-switch.component'; import { GridThumbnailComponent } from './object-grid/grid-thumbnail/grid-thumbnail.component'; import { VarDirective } from './utils/var.directive'; +import { DragClickDirective } from './utils/drag-click.directive'; import { TruncatePipe } from './utils/truncate.pipe'; import { TruncatableComponent } from './truncatable/truncatable.component'; import { TruncatableService } from './truncatable/truncatable.service'; @@ -104,7 +105,8 @@ const PROVIDERS = [ ]; const DIRECTIVES = [ - VarDirective + VarDirective, + DragClickDirective ]; @NgModule({ diff --git a/src/app/shared/truncatable/truncatable-part/truncatable-part.component.scss b/src/app/shared/truncatable/truncatable-part/truncatable-part.component.scss index bb26239c57..ac3641df39 100644 --- a/src/app/shared/truncatable/truncatable-part/truncatable-part.component.scss +++ b/src/app/shared/truncatable/truncatable-part/truncatable-part.component.scss @@ -49,7 +49,7 @@ $h4-factor: strip-unit($h4-font-size); .clamp-none { overflow: hidden; @for $i from 1 through 15 { - &.min-#{$i} { + &.fixedHeight.min-#{$i} { transition: height 1s; @include min($i); &.title { diff --git a/src/app/shared/truncatable/truncatable.component.html b/src/app/shared/truncatable/truncatable.component.html index d3ed37e596..c03e93c2ce 100644 --- a/src/app/shared/truncatable/truncatable.component.html +++ b/src/app/shared/truncatable/truncatable.component.html @@ -1,3 +1,3 @@ -
+
\ No newline at end of file diff --git a/src/app/shared/utils/drag-click.directive.ts b/src/app/shared/utils/drag-click.directive.ts new file mode 100644 index 0000000000..ec9b02dea5 --- /dev/null +++ b/src/app/shared/utils/drag-click.directive.ts @@ -0,0 +1,23 @@ +import { Directive, EventEmitter, HostListener, Output } from '@angular/core'; + +@Directive({ + selector: '[dsDragClick]' +}) +export class DragClickDirective { + private start; + @Output() actualClick = new EventEmitter(); + + @HostListener('mousedown', ['$event']) + mousedownEvent(event) { + this.start = new Date(); + } + + @HostListener('mouseup', ['$event']) + mouseupEvent(event) { + const end: any = new Date(); + const clickTime = end - this.start; + if (clickTime < 250) { + this.actualClick.emit(event) + } + } +}