layerchart 0.38.5 → 0.38.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3,7 +3,7 @@ import { writable } from 'svelte/store';
3
3
  import { scaleCanvas } from 'layercake';
4
4
  import { cls } from 'svelte-ux';
5
5
  import { transformContext } from '../TransformContext.svelte';
6
- const { width, height, padding } = getContext('LayerCake');
6
+ const { width, height, containerWidth, containerHeight, padding } = getContext('LayerCake');
7
7
  /** The `<canvas>` tag. Useful for bindings. */
8
8
  export let element = undefined;
9
9
  /** The `<canvas>`'s 2d context. Useful for bindings. */
@@ -29,8 +29,9 @@ onMount(() => {
29
29
  });
30
30
  const { mode, scale, translate } = transformContext();
31
31
  $: if (context) {
32
- scaleCanvas(context, $width, $height);
33
- context.clearRect(0, 0, $width, $height);
32
+ scaleCanvas(context, $containerWidth, $containerHeight);
33
+ context.clearRect(0, 0, $containerWidth, $containerHeight);
34
+ context.translate($padding.left, $padding.top);
34
35
  if (mode === 'canvas') {
35
36
  const center = { x: $width / 2, y: $height / 2 };
36
37
  const newTranslate = {
@@ -49,14 +50,10 @@ setContext('canvas', { ctx });
49
50
 
50
51
  <canvas
51
52
  bind:this={element}
52
- style:top="{$padding.top}px"
53
- style:right="{$padding.right}px"
54
- style:bottom="{$padding.bottom}px"
55
- style:left="{$padding.left}px"
56
53
  style:z-index={zIndex}
57
54
  class={cls(
58
55
  'layercake-layout-canvas',
59
- 'absolute w-full h-full',
56
+ 'absolute top-0 left-0 w-full h-full',
60
57
  pointerEvents === false && 'pointer-events-none',
61
58
  $$props.class
62
59
  )}
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "author": "Sean Lynch <techniq35@gmail.com>",
5
5
  "license": "MIT",
6
6
  "repository": "techniq/layerchart",
7
- "version": "0.38.5",
7
+ "version": "0.38.6",
8
8
  "devDependencies": {
9
9
  "@changesets/cli": "^2.27.5",
10
10
  "@mdi/js": "^7.4.47",