KineticJS icon indicating copy to clipboard operation
KineticJS copied to clipboard

Canvas css margin issue

Open v1r opened this issue 14 years ago • 7 comments

Hi Eric,

There is an issue with the canvas css margin. Everything drawn in the canvas will lost its position if u set a css margin to the canvas.

Take a look : http://jsfiddle.net/v1r00z/RNLxb/15/ try to click or drag the shape from the top area left to the shape.

v1r avatar Oct 16 '12 16:10 v1r

don't do that! I may need to hardcode styles inside the canvas tags so that people's canvas styles don't interfere with the stage DOM.

This problem isn't unique to KineticJS, but any widget from any library. If users override widget CSS styling, the widget UI may be compromised.

ericdrowell avatar Oct 16 '12 22:10 ericdrowell

On second thought, I'll go ahead and hardcode positional styles (e.g. margins, padding, display, position, etc) and hook those changes into this issue.

Thanks!

ericdrowell avatar Oct 16 '12 22:10 ericdrowell

Thanks, adding a hook for this will be awesome!

v1r avatar Oct 22 '12 20:10 v1r

so new canvases will now be have inline position, width, height, margin, border, padding, and background defaults. Anything other styles we should worry about?

ericdrowell avatar Feb 15 '13 23:02 ericdrowell

fixed:

https://github.com/ericdrowell/KineticJS/commit/ca0d3790b287f3dec2a76fd3a3c948d37a12bf3f

ericdrowell avatar Feb 15 '13 23:02 ericdrowell

Great! Nothing else as far as I know.

v1r avatar Feb 15 '13 23:02 v1r

Hey, can we re-open this issue? Hardcoded width and heights break responsive layouts. It'd be great if we could disable default styles so we can write our own without having to do overrides.

vorpalhex avatar Sep 23 '14 14:09 vorpalhex