mirror of
				https://github.com/Tencent/tmagic-editor.git
				synced 2025-11-04 02:28:04 +08:00 
			
		
		
		
	fix(editor): 样式优化调整
This commit is contained in:
		
							parent
							
								
									73ffc6580d
								
							
						
					
					
						commit
						12de0f5414
					
				@ -57,6 +57,7 @@ export default defineComponent({
 | 
			
		||||
        width: ${props.width}px;
 | 
			
		||||
        height: ${props.height}px;
 | 
			
		||||
        position: absolute;
 | 
			
		||||
        margin-top: 30px;
 | 
			
		||||
      `,
 | 
			
		||||
      ),
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
@ -1,16 +1,16 @@
 | 
			
		||||
<template>
 | 
			
		||||
  <div class="m-editor-nav-menu" :style="{ height: `${height}px` }">
 | 
			
		||||
    <div v-for="key in keys" :class="`menu-${key}`" :key="key">
 | 
			
		||||
    <div v-for="key in keys" :class="`menu-${key}`" :key="key" :style="`width: ${columnWidth?.[key]}px`">
 | 
			
		||||
      <tool-button :data="item" v-for="(item, index) in data[key]" :key="index"></tool-button>
 | 
			
		||||
    </div>
 | 
			
		||||
  </div>
 | 
			
		||||
</template>
 | 
			
		||||
 | 
			
		||||
<script lang="ts">
 | 
			
		||||
import { computed, defineComponent, PropType } from 'vue';
 | 
			
		||||
import { computed, defineComponent, inject, PropType } from 'vue';
 | 
			
		||||
 | 
			
		||||
import ToolButton from '@editor/components/ToolButton.vue';
 | 
			
		||||
import { MenuBarData } from '@editor/type';
 | 
			
		||||
import { GetColumnWidth, MenuBarData, Services } from '@editor/type';
 | 
			
		||||
 | 
			
		||||
export default defineComponent({
 | 
			
		||||
  name: 'nav-menu',
 | 
			
		||||
@ -29,8 +29,12 @@ export default defineComponent({
 | 
			
		||||
  },
 | 
			
		||||
 | 
			
		||||
  setup(props) {
 | 
			
		||||
    const services = inject<Services>('services');
 | 
			
		||||
 | 
			
		||||
    return {
 | 
			
		||||
      keys: computed(() => Object.keys(props.data) as Array<keyof MenuBarData>),
 | 
			
		||||
 | 
			
		||||
      columnWidth: computed(() => services?.uiService.get<GetColumnWidth>('columnWidth')),
 | 
			
		||||
    };
 | 
			
		||||
  },
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
@ -21,12 +21,12 @@
 | 
			
		||||
    align-items: center;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  .menu-left {
 | 
			
		||||
    padding-left: 16px;
 | 
			
		||||
  .menu-center {
 | 
			
		||||
    justify-content: center;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  .menu-right {
 | 
			
		||||
    padding-right: 16px;
 | 
			
		||||
    justify-content: flex-end;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  .menu-item {
 | 
			
		||||
 | 
			
		||||
@ -15,6 +15,7 @@
 | 
			
		||||
  position: relative;
 | 
			
		||||
  border: 1px solid $--border-color;
 | 
			
		||||
  transition: transform 0.3s;
 | 
			
		||||
  box-sizing: content-box;
 | 
			
		||||
 | 
			
		||||
  &::-webkit-scrollbar {
 | 
			
		||||
    width: 0 !important;
 | 
			
		||||
 | 
			
		||||
@ -25,7 +25,8 @@ export class ScrollViewer {
 | 
			
		||||
      const { width, height } = contentRect;
 | 
			
		||||
      const targetRect = this.target.getBoundingClientRect();
 | 
			
		||||
      const targetWidth = targetRect.width * this.zoom;
 | 
			
		||||
      const targetHeight = targetRect.height * this.zoom;
 | 
			
		||||
      const targetMarginTop = Number(this.target.style.marginTop) || 0;
 | 
			
		||||
      const targetHeight = (targetRect.height + targetMarginTop) * this.zoom;
 | 
			
		||||
 | 
			
		||||
      if (targetWidth < width) {
 | 
			
		||||
        (this.target as any)._left = 0;
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user