Skip to content
This repository was archived by the owner on Nov 22, 2024. It is now read-only.

Commit 661bd1d

Browse files
committed
Make sure <LiterallyCanvas> and initWithoutGUI() both respect opts.imageSize.height
fixes literallycanvas/literallycanvas#405 fixes literallycanvas/literallycanvas#424 fixes literallycanvas/literallycanvas#433
1 parent d4c8d82 commit 661bd1d

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

src/index.coffee

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,9 @@ initWithoutGUI = (el, opts) ->
8181
if el.className.includes('toolbar-hidden') == false
8282
el.className = el.className + ' toolbar-hidden'
8383

84+
if ('imageSize' of opts && 'height' of opts.imageSize)
85+
el.style.height = opts.imageSize.height + 'px'
86+
8487
drawingViewElement = document.createElement('div')
8588
drawingViewElement.className = 'lc-drawing'
8689
el.appendChild(drawingViewElement)

src/reactGUI/LiterallyCanvas.jsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,16 +70,21 @@ const LiterallyCanvas = React.createClass({
7070

7171
render() {
7272
const { lc, toolButtonComponents, props } = this;
73-
const { imageURLPrefix, toolbarPosition } = this.lc.opts;
73+
const { imageURLPrefix, toolbarPosition, imageSize } = this.lc.opts;
7474

7575
const pickerProps = { lc, toolButtonComponents, imageURLPrefix };
7676
const topOrBottomClassName = classSet({
7777
'toolbar-at-top': toolbarPosition === 'top',
7878
'toolbar-at-bottom': toolbarPosition === 'bottom',
7979
'toolbar-hidden': toolbarPosition === 'hidden'
8080
});
81+
82+
const style = {}
83+
if (imageSize.height)
84+
style.height = imageSize.height
85+
8186
return (
82-
<div className={`literally ${topOrBottomClassName}`}>
87+
<div className={`literally ${topOrBottomClassName}`} style={style}>
8388
<CanvasContainer ref={item => this.canvas = item} />
8489
<Picker {...pickerProps} />
8590
<Options lc={lc} imageURLPrefix={imageURLPrefix} />

0 commit comments

Comments
 (0)