this. inline-block. yes.
Chris Pressey
10 years ago
37 | 37 | * than the desired width & height? defaults to true. |
38 | 38 | * `missingCanvasElement`: if allowContraction is false, this should be |
39 | 39 | * a DOM element whose `display` style will be changed from `none` to |
40 | * `block` when the viewport is too small to display the canvas. | |
40 | * `inline-block` when the viewport is too small to display the canvas. | |
41 | 41 | * `centerVertically`: should we apply a top margin to the canvas |
42 | 42 | * element, to equal half the available space below it, after resizing |
43 | 43 | * it? defaults to defaults to true. |
126 | 126 | if (newWidth > availWidth || newHeight > availHeight) { |
127 | 127 | // due to not allowing contraction, our canvas is still |
128 | 128 | // too big to display. hide it and show the other thing |
129 | canvas.style.display = 'none'; | |
129 | this.canvas.style.display = 'none'; | |
130 | 130 | if (this.missingCanvasElement) { |
131 | this.missingCanvasElement.style.display = 'block'; | |
131 | this.missingCanvasElement.style.display = 'inline-block'; | |
132 | 132 | } |
133 | 133 | } else { |
134 | canvas.style.display = 'block'; | |
134 | this.canvas.style.display = 'inline-block'; | |
135 | 135 | if (this.missingCanvasElement) { |
136 | 136 | this.missingCanvasElement.style.display = 'none'; |
137 | 137 | } |