If canvas parent is set then canvas fits parent element, otherwise canvas fits window.