修复取色器父级hidden覆盖bug

This commit is contained in:
KeiferJu 2020-06-10 16:48:12 +08:00
parent 48b31a01e0
commit 69eb33632a
3 changed files with 6618 additions and 5 deletions

View File

@ -2,7 +2,7 @@
"name": "svelma-pro", "name": "svelma-pro",
"svelte": "src/index.js", "svelte": "src/index.js",
"description": "Based on svelma project extension and modification", "description": "Based on svelma project extension and modification",
"version": "1.2.0", "version": "1.2.1",
"author": "KeiferJu", "author": "KeiferJu",
"license": "MIT", "license": "MIT",
"keywords": [ "keywords": [
@ -30,6 +30,7 @@
"bulma": "^0.8.0" "bulma": "^0.8.0"
}, },
"dependencies": { "dependencies": {
"emotion": "^10.0.27",
"tinycolor2": "^1.4.1", "tinycolor2": "^1.4.1",
"tippy.js": "^6.2.3" "tippy.js": "^6.2.3"
}, },

View File

@ -10,9 +10,16 @@
export let width = "200px"; export let width = "200px";
let active = false; let active = false;
let panelX = 0;
let panelY = 0;
let transformX = 0;
onMount(() => {}); onMount(() => {});
function openChrome(event) { function openChrome(event) {
panelX = event.clientX - event.offsetX;;
panelY = event.clientY;
transformX = event.target.offsetWidth + 5;
if (!active) { if (!active) {
active = true; active = true;
} }
@ -39,9 +46,8 @@
} }
.smx-color-panel { .smx-color-panel {
position: absolute; position: fixed;
top: -105px; z-index: 9999;
right: -250px;
} }
</style> </style>
<svelte:window on:click={closeChrome}/> <svelte:window on:click={closeChrome}/>
@ -55,7 +61,7 @@
style="background: {color};" style="background: {color};"
readonly /> readonly />
{#if active} {#if active}
<div class="smx-color-panel" on:click|stopPropagation> <div class="smx-color-panel" on:click|stopPropagation style="top: {panelY}px;left:{panelX}px;transform: translate({transformX}px, -50%)">
<Chrome startColor={color} on:input={handleInput} fieldsIndex={fieldsIndex}/> <Chrome startColor={color} on:input={handleInput} fieldsIndex={fieldsIndex}/>
</div> </div>
{/if} {/if}

6606
yarn.lock Normal file

File diff suppressed because it is too large Load Diff