javascript - Resize canvas based on number of canvas wrt to parent div -


i have viewport of dimension. currently, showing single image drawn on html5 canvas. need show multiple canvas range 1-6. requirement resize canvases based on number of canvas fits parent div.

for example : single canvas should take 100% of parent div, 2 canvas 50-50%. 6 canvas 2 rows 3 canvas each.

also, user can toggle show/hide of canvas have rearrange.

how can go doing this? using angularjs ,javascript , html5 css3.

check out css flexbox can auto-size , auto-arrange multiple canvases inside container div.

flexbox easy use after small learning curve.

declare div flexbox container:

#thediv{ display: flex; } 

and tell flexbox how want canvas-items displayed:

#thediv{ flex-flow: row wrap; } 

you haven't detailed how want canvases grow / shrink when container div resized or when user hides / shows canvases, flexbox has grow / shrink settings can apply canvas-items , specific canvas(s).


Comments

Popular posts from this blog

scala - 'wrong top statement declaration' when using slick in IntelliJ -

c# - DevExpress.Wpf.Grid.InfiniteGridSizeException was unhandled -

PySide and Qt Properties: Connecting signals from Python to QML -