Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SC.Canvas appears to add a <canvas> element inside a <div class="container"> causing an issue with Tailwind CSS #60

Open
hardingjam opened this issue Jun 10, 2022 · 2 comments

Comments

@hardingjam
Copy link

hardingjam commented Jun 10, 2022

This is my code for a Canvas.svelte component

<script lang="ts">
	import * as SC from 'svelte-cubed';
	import * as THREE from 'three';
	import ReusableGltf from '$lib/components/atoms/ReusableGLTF.svelte';
	import { updateModelStatus } from '$lib/stores/stores';
	export let modelURL;

	function handleStatusChange(evt) {
		updateModelStatus(evt.detail);
	}
</script>

<SC.Canvas antialias shadows background={new THREE.Color('papayawhip')}>
	<SC.PerspectiveCamera position={[0.5, 0, 10]} />

	<SC.OrbitControls enableZoom={false} />

	<SC.DirectionalLight
		color={new THREE.Color(0xffffff)}
		position={[10, 10, 10]}
		intensity={1}
		shadow={false}
	/>
	<SC.AmbientLight color={new THREE.Color(0xffffff)} intensity={0.75} />
	<ReusableGltf {modelURL} on:statusChange={handleStatusChange} />
</SC.Canvas>

DevTools shows the following elements in the DOM tree:

image

Is the SC.Canvas automatically embedded in this <div class="container">?
When using tailwind, this causes the div to have the same dimensions as the next-lowest media query breakpoint. It would make it necessary to override the Tailwind container class, in order to properly resize the canvas.

@DefinitelyMaybe
Copy link

yes it is.

or copy the source into local project and adjust to suit.

@TrippleCCC
Copy link

I'm having a similar issue as well. Would it be possible to change the library to use a name like sc-container? I think this would fix the issue and make the library more compatible with other libraries that use a container class. I would be happy to take up this issue if needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants