aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBob Zeleznik <zzzman@gmail.com>2020-04-04 13:06:34 -0400
committerBob Zeleznik <zzzman@gmail.com>2020-04-04 13:06:34 -0400
commitafc7afcea84463d7e7048e5f318bbd13a72f3e95 (patch)
treeadc581b79e4ca9c1484e1e82cc7324568a20e977 /src
parent7961a79950ce4b26c6715383dae455ced995a7c4 (diff)
added double click to open lightbox from carousel.
Diffstat (limited to 'src')
-rw-r--r--src/client/views/RecommendationsBox.scss9
-rw-r--r--src/client/views/collections/CollectionCarouselView.scss1
-rw-r--r--src/client/views/collections/CollectionCarouselView.tsx27
-rw-r--r--src/client/views/collections/CollectionView.tsx3
4 files changed, 33 insertions, 7 deletions
diff --git a/src/client/views/RecommendationsBox.scss b/src/client/views/RecommendationsBox.scss
index dd8a105f6..7d89042a4 100644
--- a/src/client/views/RecommendationsBox.scss
+++ b/src/client/views/RecommendationsBox.scss
@@ -54,10 +54,11 @@
margin-left: 5px;
}
-img{
- width: 100%;
- height: 100%;
-}
+// bcz: UGH!! Can't have global settings like this!!!
+// img{
+// width: 100%;
+// height: 100%;
+// }
.score {
// margin-left: 15px;
diff --git a/src/client/views/collections/CollectionCarouselView.scss b/src/client/views/collections/CollectionCarouselView.scss
index fd1296286..a9a1898f5 100644
--- a/src/client/views/collections/CollectionCarouselView.scss
+++ b/src/client/views/collections/CollectionCarouselView.scss
@@ -13,6 +13,7 @@
height: calc(100% - 50px);
display: inline-block;
width: 100%;
+ user-select: none;
}
}
.carouselView-back, .carouselView-fwd {
diff --git a/src/client/views/collections/CollectionCarouselView.tsx b/src/client/views/collections/CollectionCarouselView.tsx
index a0cb1fe19..9e7248db2 100644
--- a/src/client/views/collections/CollectionCarouselView.tsx
+++ b/src/client/views/collections/CollectionCarouselView.tsx
@@ -80,10 +80,33 @@ export class CollectionCarouselView extends CollectionSubView(CarouselDocument)
});
}
}
+ _downX = 0;
+ _downY = 0;
+ onPointerDown = (e: React.PointerEvent) => {
+ this._downX = e.clientX;
+ this._downY = e.clientY;
+ console.log("CAROUSEL down");
+ document.addEventListener("pointerup", this.onpointerup);
+ }
+ private _lastTap: number = 0;
+ private _doubleTap = false;
+ onpointerup = (e: PointerEvent) => {
+ console.log("CAROUSEL up");
+ this._doubleTap = (Date.now() - this._lastTap < 300 && e.button === 0 && Math.abs(e.clientX - this._downX) < 2 && Math.abs(e.clientY - this._downY) < 2);
+ this._lastTap = Date.now();
+ }
+
+ onClick = (e: React.MouseEvent) => {
+ if (this._doubleTap) {
+ e.stopPropagation();
+ this.props.Document.isLightboxOpen = true;
+ }
+ }
+
render() {
- return <div className="collectionCarouselView-outer" ref={this.createDashEventsTarget} onContextMenu={this.onContextMenu}>
+ return <div className="collectionCarouselView-outer" onClick={this.onClick} onPointerDown={this.onPointerDown} ref={this.createDashEventsTarget} onContextMenu={this.onContextMenu}>
{this.content}
- {this.buttons}
+ {this.props.Document._chromeStatus !== "replaced" ? this.buttons : (null)}
</div>;
}
} \ No newline at end of file
diff --git a/src/client/views/collections/CollectionView.tsx b/src/client/views/collections/CollectionView.tsx
index e825d96ef..729101bc3 100644
--- a/src/client/views/collections/CollectionView.tsx
+++ b/src/client/views/collections/CollectionView.tsx
@@ -99,7 +99,8 @@ export class CollectionView extends Touchable<FieldViewProps> {
public static LayoutString(fieldStr: string) { return FieldView.LayoutString(CollectionView, fieldStr); }
private _isChildActive = false; //TODO should this be observable?
- @observable private _isLightboxOpen = false;
+ get _isLightboxOpen() { return BoolCast(this.props.Document.isLightboxOpen); };
+ set _isLightboxOpen(value) { this.props.Document.isLightboxOpen = value; };
@observable private _curLightboxImg = 0;
@observable private static _safeMode = false;
public static SetSafeMode(safeMode: boolean) { this._safeMode = safeMode; }