<% if (['image', 'animation'].includes(ctx.post.type)) { %> - + <% } else if (ctx.post.type === 'flash') { %> - + @@ -14,6 +14,7 @@ <%= ctx.makeElement( 'video', { + class: 'resize-listener', controls: true, loop: (ctx.post.flags || []).includes('loop'), autoplay: ctx.autoplay, @@ -27,6 +28,6 @@ <% } else { console.log(new Error('Unknown post type')); } %> -
+
diff --git a/client/js/controls/post_content_control.js b/client/js/controls/post_content_control.js index c13fa83..ca2fca8 100644 --- a/client/js/controls/post_content_control.js +++ b/client/js/controls/post_content_control.js @@ -86,8 +86,12 @@ class PostContentControl { } _resize(width, height) { - this._postContentNode.style.width = width + 'px'; - this._postContentNode.style.height = height + 'px'; + const resizeListenerNodes = [this._postContentNode].concat( + ...this._postContentNode.querySelectorAll('.resize-listener')); + for (let node of resizeListenerNodes) { + node.style.width = width + 'px'; + node.style.height = height + 'px'; + } } _refreshSize() { diff --git a/client/js/controls/post_notes_overlay_control.js b/client/js/controls/post_notes_overlay_control.js index c2539bd..43e8bf6 100644 --- a/client/js/controls/post_notes_overlay_control.js +++ b/client/js/controls/post_notes_overlay_control.js @@ -547,6 +547,7 @@ class PostNotesOverlayControl extends events.EventTarget { this._hostNode = hostNode; this._svgNode = document.createElementNS(svgNS, 'svg'); + this._svgNode.classList.add('resize-listener'); this._svgNode.classList.add('notes-overlay'); this._svgNode.setAttribute('preserveAspectRatio', 'none'); this._svgNode.setAttribute('viewBox', '0 0 1 1');