From c7bd0cbab7e38291c51d3536d118dbfd05ddad99 Mon Sep 17 00:00:00 2001 From: sjhuang26 Date: Thu, 11 Jul 2019 18:50:30 -0400 Subject: [PATCH 1/4] Fix lag on listing hover --- web/src/app/listing/component.html | 4 ++-- web/src/app/listing/component.scss | 4 ++-- web/src/app/listing/component.ts | 1 - 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/web/src/app/listing/component.html b/web/src/app/listing/component.html index 1f86b0eb..83b45159 100644 --- a/web/src/app/listing/component.html +++ b/web/src/app/listing/component.html @@ -1,7 +1,7 @@ -
+
-
+
diff --git a/web/src/app/listing/component.scss b/web/src/app/listing/component.scss index 0e6043bd..744f0b23 100644 --- a/web/src/app/listing/component.scss +++ b/web/src/app/listing/component.scss @@ -232,7 +232,7 @@ section.closed, section.closed:hover { background: $yacs_bgs; } -.indicator-selected-hover { +.indicator-selected:hover { background: $yacs_acc; } @@ -245,7 +245,7 @@ section.closed, section.closed:hover { padding-right: 15px; } -.indicator-hover { +.indicator:hover { background: #969696; } diff --git a/web/src/app/listing/component.ts b/web/src/app/listing/component.ts index 9dd14be4..f3125900 100644 --- a/web/src/app/listing/component.ts +++ b/web/src/app/listing/component.ts @@ -26,7 +26,6 @@ export class ListingComponent implements OnInit{ public showingMenu; public showingDescription; - public hovered; public mouseMove: boolean = false; public mouseDown: boolean = false; From 571a458a0d9d11e371ae689a4ebc73ae87ad7fd4 Mon Sep 17 00:00:00 2001 From: Suhao Jeffrey Huang Date: Sun, 11 Aug 2019 17:04:03 -0400 Subject: [PATCH 2/4] Don't show description if it doesn't exist --- web/src/app/listing/component.html | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/web/src/app/listing/component.html b/web/src/app/listing/component.html index 83b45159..0afd0783 100644 --- a/web/src/app/listing/component.html +++ b/web/src/app/listing/component.html @@ -14,9 +14,16 @@
{{listing.course.subject.shortname}} {{listing.course.shortname}}
From 9c3f7083fc941dac3ac431d5f6faef2c932edab0 Mon Sep 17 00:00:00 2001 From: Suhao Jeffrey Huang Date: Sun, 11 Aug 2019 17:10:04 -0400 Subject: [PATCH 3/4] Remove dead code --- web/src/app/listing/component.ts | 21 +-------------------- 1 file changed, 1 insertion(+), 20 deletions(-) diff --git a/web/src/app/listing/component.ts b/web/src/app/listing/component.ts index f3125900..b58c4ad1 100644 --- a/web/src/app/listing/component.ts +++ b/web/src/app/listing/component.ts @@ -27,9 +27,6 @@ export class ListingComponent implements OnInit{ public showingMenu; public showingDescription; - public mouseMove: boolean = false; - public mouseDown: boolean = false; - ngOnInit () { this.showingMenu = false; this.showingDescription = false; @@ -71,24 +68,8 @@ export class ListingComponent implements OnInit{ return this.conflictsService.doesConflict(section); } - public mouseDownFunc (): void { - this.mouseDown = true; - } - - public mouseMoveFunc (): void { - if (this.mouseDown) { - this.mouseMove = true; - } - } - public descriptionClick (event): void { - event.stopPropagation(); - if (this.mouseMove) { - this.selectionService.toggleCourse(this.listing); - } - - this.mouseMove = false; - this.mouseDown = false; + this.selectionService.toggleCourse(this.listing); } public get tooltipDescription (): string { From 6e9af5a5d23cbd814cc7c7ea93f302257fc56e53 Mon Sep 17 00:00:00 2001 From: sjhuang26 Date: Sun, 11 Aug 2019 17:35:04 -0400 Subject: [PATCH 4/4] Additional fixes --- web/src/app/listing/component.html | 8 ++++---- web/src/app/listing/component.ts | 25 +++++++++++++++++++++---- 2 files changed, 25 insertions(+), 8 deletions(-) diff --git a/web/src/app/listing/component.html b/web/src/app/listing/component.html index 0afd0783..3adfbe6b 100644 --- a/web/src/app/listing/component.html +++ b/web/src/app/listing/component.html @@ -35,10 +35,10 @@ diff --git a/web/src/app/listing/component.ts b/web/src/app/listing/component.ts index b58c4ad1..6421e5eb 100644 --- a/web/src/app/listing/component.ts +++ b/web/src/app/listing/component.ts @@ -51,6 +51,24 @@ export class ListingComponent implements OnInit{ this.selectionService.toggleCourse(this.listing); } + public descriptionClick (event) { + // Relevant: https://stackoverflow.com/questions/10390010/jquery-click-is-triggering-when-selecting-highlighting-text + event.stopPropagation(); + if (window.getSelection) { + // This operation checks "globally" to see if there are any highlights anywhere. + // If there are, course clicks are disabled. + // But remember that when the user makes a "true" click all other highlights are unmarked. + // So it isn't possible for a highlight in one part of the app to break the rest. + const selection = window.getSelection(); + if (!selection.toString()) { + this.clickCourse(); + } + } else { + // selection API not supported -- oh well + this.clickCourse(); + } + } + public isCourseSelected () { return this.selectionService.hasSelectedSection(this.listing); } @@ -60,6 +78,9 @@ export class ListingComponent implements OnInit{ } public clickSection (section: Section): void { + if (window.getSelection().toString()) { + + } this.selectionService.toggleSection(section); } @@ -68,10 +89,6 @@ export class ListingComponent implements OnInit{ return this.conflictsService.doesConflict(section); } - public descriptionClick (event): void { - this.selectionService.toggleCourse(this.listing); - } - public get tooltipDescription (): string { return this.listing.description || 'No description available :('; }
-
{{listing.description}}
+
+ {{listing.description}} +
 
-
Conflicting Sections
-
Conflicting Sections
-
Full Sections
-
Full Sections
+
Conflicting Sections
+
Conflicting Sections
+
Full Sections
+
Full Sections