@@ -18,6 +18,8 @@ import '@material/mwc-icon';
1818import { css , html , LitElement } from 'lit' ;
1919import { customElement , property , query } from 'lit/decorators.js' ;
2020
21+ import { Tab } from './tab' ;
22+
2123/** Returns the element at domPath or null. */
2224function getShadowElement ( domPath : string [ ] ) : Element | null {
2325 let element : Element | null | undefined = null ;
@@ -32,13 +34,12 @@ function getShadowElement(domPath: string[]): Element|null {
3234/** Overlay element describing the other elements behind it. */
3335@customElement ( 'help-ui' )
3436export class HelpUi extends LitElement {
35- @property ( ) displaySentence ! : boolean ;
37+ @property ( ) displayedTab ! : Tab ;
3638
3739 // Always returned by render() so cannot be null.
3840 @query ( '#closeButton' ) private readonly closeButton ! : HTMLElement ;
3941
4042 // Containers of descriptive text blocks.
41- // Always returned by render() so cannot be null.
4243 @query ( '#numComparisonsDescription' )
4344 private readonly numComparisonsDescription ! : HTMLElement ;
4445 @query ( '#matchersDescription' )
@@ -48,6 +49,8 @@ export class HelpUi extends LitElement {
4849 @query ( '#batchSelectionsDescription' )
4950 private readonly batchSelectionsDescription ! : HTMLElement ;
5051 @query ( '#graphDescription' ) private readonly graphDescription ! : HTMLElement ;
52+ @query ( '#galleryDescription' )
53+ private readonly galleryDescription ! : HTMLElement ;
5154
5255 onOpen ( ) {
5356 // Position the closing button on top of the home page's help button
@@ -74,14 +77,14 @@ export class HelpUi extends LitElement {
7477 // The main interactive user interface elements are on the fixed left menu.
7578 // Position the "tooltips" on the right of them to keep them visible.
7679 // The "tooltips" cover parts of the graph but this works visually.
77- if ( this . displaySentence ) {
80+ if ( this . displayedTab === Tab . SUMMARY ) {
7881 positionElementAtTheRightOf (
7982 this . matchersDescription ,
8083 [ 'codec-compare' , 'sentence-ui' , '#matchers' ] ) ;
8184 positionElementAtTheRightOf (
8285 this . batchSelectionsDescription ,
8386 [ 'codec-compare' , 'sentence-ui' , '#batches' ] ) ;
84- } else {
87+ } else if ( this . displayedTab === Tab . STATS ) {
8588 positionElementAtTheRightOf (
8689 this . numComparisonsDescription , [ 'codec-compare' , '#numComparisons' ] ) ;
8790 positionElementAtTheRightOf (
@@ -91,6 +94,10 @@ export class HelpUi extends LitElement {
9194 positionElementAtTheRightOf (
9295 this . batchSelectionsDescription ,
9396 [ 'codec-compare' , 'batch-selections-ui' ] ) ;
97+ } else if ( this . displayedTab === Tab . GALLERY ) {
98+ positionElementAtTheRightOf (
99+ this . galleryDescription ,
100+ [ 'codec-compare' , 'gallery-ui' , '#sourceDataSet' ] ) ;
94101 }
95102
96103 // This is not the description of the #referenceBatch <p> but it is used as
@@ -109,7 +116,7 @@ export class HelpUi extends LitElement {
109116 this . requestUpdate ( ) ;
110117 }
111118
112- private renderSentenceHelp ( ) {
119+ private renderSummaryHelp ( ) {
113120 return html `
114121 <div class= "descriptionHolder" id = "numComparisonsDescription" >
115122 </ div>
@@ -130,12 +137,13 @@ export class HelpUi extends LitElement {
130137 <div class= "bracket" > </ div>
131138 <p>
132139 Batches are aggregated by codec .<br>
133- The advanced interface can be enabled in the settings (left bar).
140+ See the ADVANCED tab for more information and to change the comparison
141+ reference , criteria and shown metrics .
134142 </ p>
135143 </ div> ` ;
136144 }
137145
138- private renderTuneableComparisonHelp ( ) {
146+ private renderAdvancedHelp ( ) {
139147 return html `
140148 <div class= "descriptionHolder" id = "numComparisonsDescription" >
141149 <div class= "bracket" > </ div>
@@ -152,10 +160,11 @@ export class HelpUi extends LitElement {
152160 <div class= "descriptionHolder" id = "matchersDescription">
153161 <div class= "bracket" > </ div>
154162 <p>
155- Pairs are selected so that these constraints are respected . Objective
156- visual distortion metrics such as PSNR and SSIM can be used as matchers
157- to compare formats and codecs on other metrics such as compression rate
158- and encoding duration .<br>
163+ Pairs are selected so that these constraints are respected . When
164+ comparing lossy compression methods , objective visual distortion metrics
165+ such as PSNR and SSIM can be used as matchers to compare formats and
166+ codecs on other metrics such as compression rate and encoding duration .
167+ <br>
159168 Numerical fields can be matched with a relative tolerance . If so , pairs
160169 are selected to minimize the difference of the values of these fields .
161170 </ p>
@@ -175,7 +184,12 @@ export class HelpUi extends LitElement {
175184 different codecs , or the same codec with different settings . Each batch
176185 has an associated color .<br>
177186 Click the info button to see batch metadata and data points . Some data
178- points may be filtered out .<br>
187+ points may be filtered out . When comparing lossy compression methods , it
188+ is recommended to filter based on
189+ <a href= "https://github.com/webmproject/codec-compare/wiki/Bits-per-pixel-of-Internet-images"
190+ target = "_blank" >
191+ bits-per-pixel usually seen on the web
192+ <mwc- icon> open_in_new </ mwc- icon> </ a> .<br>
179193 Click the focus button to set a batch as the reference to compare the
180194 others against .<br>
181195 The statistics relative to the reference batch for the fields selected
@@ -185,6 +199,20 @@ export class HelpUi extends LitElement {
185199 </ div> ` ;
186200 }
187201
202+ private renderDatasetHelp ( ) {
203+ return html `
204+ <div class= "descriptionHolder" id = "galleryDescription">
205+ <div class= "bracket" > </ div>
206+ <p>
207+ These media assets were compressed and decompressed with the codecs
208+ presented here to compare their relative performance .<br>
209+ <br>
210+ The count associated with each asset corresponds to the number of
211+ matched pairs based on that asset .
212+ </ p>
213+ </ div> ` ;
214+ }
215+
188216 override render ( ) {
189217 const onClose = ( ) => {
190218 this . style . display = 'none' ;
@@ -196,17 +224,18 @@ export class HelpUi extends LitElement {
196224 </ div>
197225
198226 ${
199- this . displaySentence ? this . renderSentenceHelp ( ) :
200- this . renderTuneableComparisonHelp ( ) }
227+ this . displayedTab === Tab . SUMMARY ? this . renderSummaryHelp ( ) :
228+ this . displayedTab === Tab . STATS ? this . renderAdvancedHelp ( ) :
229+ this . renderDatasetHelp ( ) }
201230
202231 <div class= "descriptionHolder" id = "graphDescription">
203232 <p>
204233 The codecs are plotted on this graph as large disks , with the metric
205234 fields as axes . If any , batches sharing the same codec are linked with
206235 straight lines , usually to represent multiple encoding efforts .<br>
207- If enabled in the Settings page , each matched pair is displayed as a
208- tiny dot . Click on any to display the details of the reference batch and
209- of the compared batch .<br>
236+ If enabled in the Settings , each matched pair is displayed as a tiny
237+ dot . Click on any to display the details of the reference batch and of
238+ the compared batch .<br>
210239 <br>
211240 For an introduction to image file formats , please see this
212241 <a href= "https://en.wikipedia.org/wiki/Image_file_format"
0 commit comments