Skip to content

Commit 01c200b

Browse files
committed
Embedded videos: Show them half-transparent before enabling video controls.
So the user can move the video before click and start using video controls after click. This commit also hides the scaling sections for better focus on the video. Signed-off-by: Gökay Şatır <[email protected]> Change-Id: Ibce4c88476e1fe8d7346d74e7d64a11f7edd4071
1 parent 19fc003 commit 01c200b

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

browser/src/canvas/sections/ShapeHandlesSection.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -445,6 +445,7 @@ class ShapeHandlesSection extends CanvasSectionObject {
445445
addEmbeddedVideo(svgString: any) {
446446
this.sectionProperties.hasVideo = true;
447447
this.setSVG(svgString);
448+
this.sectionProperties.svg.style.opacity = 0.5;
448449
this.sectionProperties.svg.remove();
449450
document.getElementById('canvas-container').appendChild(this.sectionProperties.svg);
450451
this.sectionProperties.svg.style.zIndex = 11; // Update z-index or video buttons are unreachable.
@@ -1138,6 +1139,11 @@ class ShapeHandlesSection extends CanvasSectionObject {
11381139
app.activeDocument.mouseControl.onContextMenu(point, e);
11391140
}
11401141

1142+
private hideSubSections() {
1143+
for (let i = 0; i < this.sectionProperties.subSections.length; i++)
1144+
this.sectionProperties.subSections[i].setShowSection(false);
1145+
}
1146+
11411147
onClick(point: cool.SimplePoint, e: MouseEvent): void {
11421148
point.pX += this.position[0];
11431149
point.pY += this.position[1];
@@ -1154,6 +1160,16 @@ class ShapeHandlesSection extends CanvasSectionObject {
11541160

11551161
this.sectionProperties.lastTapTime = Date.now();
11561162
}
1163+
1164+
if (this.sectionProperties.hasVideo && this.sectionProperties.svg) {
1165+
const videoObject = this.sectionProperties.svg.querySelector('video');
1166+
1167+
if (videoObject) {
1168+
this.sectionProperties.svg.style.opacity = 1;
1169+
this.sectionProperties.svg.style.pointerEvents = '';
1170+
this.hideSubSections();
1171+
}
1172+
}
11571173
}
11581174

11591175
onDoubleClick(point: cool.SimplePoint, e: MouseEvent): void {

0 commit comments

Comments
 (0)