angularjs and paper.js full width specific height canvas -
i trying create navigation on top of web page via canvas using angularjs , paperjs.
my angularjs directive inits paper.js
.directive('draw', function () { return { restrict: 'a', link: function postlink(scope, element, attrs) { onresize = function (event){ console.log('aaa') } function initpaper() { paper.install(window); paper.setup('canvas'); view.onresize = onresize; } initpaper(); } };
if write nav canvas html that:
<canvas id="canvas" draw style='width:100% height:35px' ></canvas>
everything works fine elements on canvas stretches according canvas size ( not want stretching , paperjs onresize event not work.
if write nav canvas html that:
<canvas id="canvas" draw resize style='height:35px'></canvas>
canvas width not full...
what can create canvas full width, 35px tall , not stretches element on when resized. , listens resize events via paperjs...?
i have found solution this:
html ( paperjs reacts window resizings )
<canvas id="canvas" draw resize ></canvas>
inside angularjs directive via onresize event window width , set...
onresize = function (event){ view.viewsize = [event.size.width, 35] }
i not sure if correct way. wonder if there better way...
Comments
Post a Comment