当前位置: 首页 > 编程笔记 >

Vue-drag-resize 拖拽缩放插件的使用(简单示例)

刁文光
2023-03-14
本文向大家介绍Vue-drag-resize 拖拽缩放插件的使用(简单示例),包括了Vue-drag-resize 拖拽缩放插件的使用(简单示例)的使用技巧和注意事项,需要的朋友参考一下

字幕

<div id="lBox" style="background-color: #D7E9F5;"
     :style="{'height': parentHeight + 'px', 'width': parentWidth + 'px'}">
     
 <drag-resize v-for="(rect,index) in texts"
       style="overflow: hidden;"
       :w="rect.BoxWidth"
       :h="rect.BoxHeight"
       :x="rect.BoxLeft"
       :y="rect.BoxTop"
       @resizing="textResize($event, index)" 
       @dragging="textResize($event, index)">
       
 <div style="width: 100%; height: 100%;"
 :style={backgroundColor:rect.BoxColor,opacity:rect.BoxOpacity}>
 </div><!-- 控制背景色及背景透明度 使背景透明度不影响字幕 -->
    
 <div style="width: 100%; height: 100%;">
    <p :class="rect.Direction === 'Left to Right' ? 'roll-right' : 'roll-left'"
      style="width: 100%; position:absolute; bottom:-0.25em;left:0px"
      :style="{color: rect.TextColor,fontFamily: rect.FontFile,
     fontSize: rect.FontSize+'px',
     opacity:rect.FontOpacity,
     animationDuration: rect.Speed + 's'}">
     {{rect.Text}}
    </p>
 </div>
 
 </drag-resize>

logo

 <drag-resize v-for="(rect,index) in logos"
      :parentLimitation="true"
      :w="rect.Width"
      :h="rect.Height"
      :x="rect.Left"
      :y="rect.Top"
      @resizing="logoResize($event, index)" 
      @dragging="logoResize($event, index)">
       
    <div style="width: 100%;height: 100%;">
     <img :src="'/logos/' + rect.FileName"
      style="width: 100%;height: 100%;">
    </div>
    
 </drag-resize>
</div>

JS

textResize(newRect, index) {
  const BoxWidth = newRect.width+''
  this.texts[index].BoxWidth = BoxWidth.substring(0, BoxWidth.indexOf("."))

  const BoxHeight = newRect.height+''
  this.texts[index].BoxHeight = BoxHeight.substring(0, BoxHeight.indexOf("."))

  const BoxTop = newRect.top+''
  this.texts[index].BoxTop = BoxTop.substring(0, BoxTop.indexOf("."))

  const BoxLeft = newRect.left+''
  this.texts[index].BoxLeft = BoxLeft.substring(0, BoxLeft.indexOf("."))
 }

 logoResize(newRect, index) {
  const Width = newRect.width''
  this.logos[index].Width = Width.substring(0, Size.indexOf("."))
  
  const Height = newRect.height+''
  this.logos[index].Height = Height .substring(0, Size.indexOf("."))
  
  const Top = newRect.top+''
  this.logos[index].Top = Top.substring(0, Top.indexOf("."))

  const Left = newRect.left+''
  this.logos[index].Left = Left.substring(0, Left.indexOf("."))
 }

除此之外还有字幕向左或向右滚动的CSS

 .roll-left {
 animation: wordsLoopLeft 6s linear infinite normal;
 }

 .roll-right {
 animation: wordsLoopRight 6s linear infinite normal;
 }

 @keyframes wordsLoopLeft {
 0% {
  transform: translateX(100%);
  -webkit-transform: translateX(100%);
 }
 100% {
  transform: translateX(-40%);
  -webkit-transform: translateX(-40%);
 }
 }

 @keyframes wordsLoopRight {
 0% {
  transform: translateX(-40%);
  -webkit-transform: translateX(-40%);
 }
 100% {
  transform: translateX(100%);
  -webkit-transform: translateX(100%);
 }
 }

And:

自定义字体在

CSS @font-face 自定义字体

总结

以上所述是小编给大家介绍的Vue-drag-resize 拖拽缩放插件的使用,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对小牛知识库网站的支持!
如果你觉得本文对你有帮助,欢迎转载,烦请注明出处,谢谢!

 类似资料:
  • 拖放功能是为使开发人员的任务变得简单而添加的强大功能之一。 实际上,拖动操作是某个UI元素上的单击手势,同时按住鼠标按钮并移动鼠标。 在拖动操作后释放鼠标按钮时发生放下操作。 语法 (Syntax) 将拖放类添加到可拖动目标。 var dd = Ext.create('Ext.dd.DD', el, 'imagesDDGroup', { isTarget: false }); 将拖放目标类

  • 本文向大家介绍Vue 实现一个简单的鼠标拖拽滚动效果插件,包括了Vue 实现一个简单的鼠标拖拽滚动效果插件的使用技巧和注意事项,需要的朋友参考一下 最近开源了一个 Vue 组件,还不够完善,欢迎大家来一起完善它,也希望大家能给个 star 支持一下,谢谢各位了。 github 地址:github.com/qq449245884… 最近在做一个新的项目,有个需要是这样的: 简单描述一下,就是鼠标拖动

  • 该插件可以拖放树节点并重新排列树。 您可以在API中找到所有dnd插件配置选项. $(function () { $("#plugins3").jstree({ "core" : { "check_callback" : true }, "plugins" : [ "dnd" ] }); });

  • 本文向大家介绍JS实现的简单拖拽功能示例,包括了JS实现的简单拖拽功能示例的使用技巧和注意事项,需要的朋友参考一下 本文实例讲述了JS实现的简单拖拽功能。分享给大家供大家参考,具体如下: 1、实例代码: 2、运行效果图如下: 更多关于JavaScript相关内容感兴趣的读者可查看本站专题:《JavaScript切换特效与技巧总结》、《JavaScript动画特效与技巧汇总》、《JavaScript

  • 本文向大家介绍vue拖拽排序插件vuedraggable使用方法详解,包括了vue拖拽排序插件vuedraggable使用方法详解的使用技巧和注意事项,需要的朋友参考一下 大家好,最近做的项目要用到拖拽排序,我现在的项目是vue项目,所以我就屁颠屁颠的去百度有木有这样功能的插件,我就知道一定会有,那就是vuedraggable,这是一款很棒的拖拽插件,下面我来说一下怎么引入 首先在vue项目中,用

  • 为用户提供drag and drop非常直观。 在许多桌面应用程序中都可以找到,用户只需用鼠标拖动对象并放在另一个窗口上就可以将对象从一个窗口复制或移动到另一个窗口。 拖放操作涉及以下步骤 - Declare a drop target 创建数据对象 创建wx.DropSource 执行拖动操作 Cancel or accept drop 在wxPython中,有两个预定义的放置目标 - wx.T