Skip to content

Commit aa450e5

Browse files
committed
Made pointing with a tablet pen work. Cleaned up marquee console errors.
1 parent 3750b46 commit aa450e5

7 files changed

Lines changed: 20 additions & 13 deletions

File tree

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "svc-ng",
3-
"version": "1.4.6",
3+
"version": "1.4.7",
44
"license": "MIT AND GPL-3.0-or-later",
55
"author": "Kerry Shetline <kerry@shetline.com>",
66
"scripts": {

src/app/app.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<div class="about-dialog">
33
<img src="/assets/resources/svc_lunar_eclipse.png" alt="lunar eclipse" width="64" height="64">
44
<h2>Sky View Café NP</h2>
5-
Version 1.4.6<br><br>
5+
Version 1.4.7<br><br>
66
Copyright © 2016-2018 Kerry Shetline.
77
</div>
88
</p-dialog>

src/app/svc/generic-view.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ export abstract class GenericView implements AfterViewInit {
7777
protected canDrag = true;
7878
protected goodDragStart = false;
7979
protected debouncedDraw: () => void;
80-
protected debouncedMouseMove: () => void;
80+
protected throttledMouseMove: () => void;
8181
protected debouncedResize: () => void;
8282
protected dragging = false;
8383
protected excludedPlanets: number[] = [EARTH];
@@ -257,18 +257,18 @@ export abstract class GenericView implements AfterViewInit {
257257
const pt = this.getXYForTouchEvent(event);
258258

259259
if (this.goodDragStart)
260-
this.handleDrag(pt.x, pt.y, true);
260+
this.handleMouseMove(pt.x, pt.y, true);
261261

262262
if (this.isInsideView())
263263
event.preventDefault();
264264
}
265265

266266
onMouseMove(event: MouseEvent): void {
267-
if (this.goodDragStart)
268-
this.handleDrag(event.offsetX, event.offsetY, !!((event.buttons & 0x01) || (this.isSafari && (event.which & 0x01))));
267+
if (this.goodDragStart || !this.dragging)
268+
this.handleMouseMove(event.offsetX, event.offsetY, !!((event.buttons & 0x01) || (this.isSafari && (event.which & 0x01))));
269269
}
270270

271-
protected handleDrag(x: number, y: number, button1Down: boolean): void {
271+
protected handleMouseMove(x: number, y: number, button1Down: boolean): void {
272272
this.lastMoveX = x;
273273
this.lastMoveY = y;
274274

@@ -290,13 +290,13 @@ export abstract class GenericView implements AfterViewInit {
290290
}
291291

292292
if (!this.dragging || justCleared) {
293-
if (!this.debouncedMouseMove) {
294-
this.debouncedMouseMove = _.debounce(() => {
293+
if (!this.throttledMouseMove) {
294+
this.throttledMouseMove = _.throttle(() => {
295295
this.draw();
296296
}, 100);
297297
}
298298

299-
this.debouncedMouseMove();
299+
this.throttledMouseMove();
300300
}
301301
}
302302

src/app/svc/svc-sky-view/svc-sky-view.component.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -441,12 +441,12 @@ export class SvcSkyViewComponent extends GenericSkyView implements AfterViewInit
441441
}
442442
}
443443

444-
handleDrag(x: number, y: number, button1Down: boolean): void {
444+
handleMouseMove(x: number, y: number, button1Down: boolean): void {
445445
const wasDragging = this.dragging;
446446
const lastX = this.lastMoveX;
447447
const lastY = this.lastMoveY;
448448

449-
super.handleDrag(x, y, button1Down);
449+
super.handleMouseMove(x, y, button1Down);
450450

451451
if (this.dragging && this.lastDrawingContext) {
452452
if (!wasDragging && !this.trackSun)

src/app/widgets/ks-marquee/ks-marquee.component.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ export class KsMarqueeComponent implements AfterViewInit, OnDestroy {
5656
this.marquee = this.marqueeRef.nativeElement;
5757
this.resizeFunction = () => this.onResize();
5858
addResizeListener(this.wrapper, this.resizeFunction);
59+
this.onResize();
5960
}
6061

6162
ngOnDestroy(): void {
@@ -70,11 +71,15 @@ export class KsMarqueeComponent implements AfterViewInit, OnDestroy {
7071
if (this.animationRequestId)
7172
window.cancelAnimationFrame(this.animationRequestId);
7273

74+
if (!this.wrapper || !this.marquee)
75+
return;
76+
7377
const marqueeWidth = this.wrapper.offsetWidth;
7478
const textWidth = getTextWidth(this.text, this.marquee);
7579

7680
this.marquee.style.width = marqueeWidth + 'px';
7781
this.marquee.scrollLeft = 0;
82+
7883
if (textWidth <= marqueeWidth)
7984
return;
8085

src/assets/about.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@
6060
<h2 class="header-sans"><a name="history">What's New / Version History</a></h2>
6161
<div style="padding-left: 1em; text-indent: -1em">
6262

63+
<p><b>1.4.7, 2018-07-30:</b> Made pointing with a tablet pen work. Cleaned up console errors.</p>
64+
6365
<p><b>1.4.6, 2018-07-29:</b> Early steps at making SVC more mobile tablet-friendly. Improved info marquee.</p>
6466

6567
<p><b>1.4.5, 2018-06-20:</b> Internal code changes.</p>

0 commit comments

Comments
 (0)