【问题标题】:Scale svg based on zoom level on 2D根据 2D 上的缩放级别缩放 svg
【发布时间】:2017-06-19 07:14:07
【问题描述】:

如何知道用户何时放大或缩小 2D dwg?我在查看器顶部使用 Snap.svg 创建了一个 svg 图层。我想根据查看器中 2D 绘图的比例来缩放该图层。

【问题讨论】:

    标签: snap.svg autodesk-forge autodesk-viewer


    【解决方案1】:

    如果您想支持移动设备,您可以使用自定义工具来挂钩用户操作,例如滚轮输入或手势:

    function AdnTool(viewer, toolName) {
    
      this.getNames = function() {
    
        return [toolName];
      };
    
      this.getName = function() {
    
        return toolName;
      };
    
      // ...
    
      this.handleWheelInput = function(delta) {
    
        console.log('-------------------');
        console.log('Tool:handleWheelInput(delta)');
        console.log(delta);
    
        return false;
      };
    
      this.handleGesture = function(event) {
    
        console.log('-------------------');
        console.log('Tool:handleGesture(event)');
        console.log(event);
    
        return false;
      };
    
      // ...
    }
    

    查看完整示例:CustomTool Extension

    【讨论】:

      猜你喜欢
      • 2018-10-07
      • 2016-06-11
      • 1970-01-01
      • 2011-10-26
      • 2013-11-18
      • 2017-10-14
      • 2015-06-21
      • 1970-01-01
      • 2012-04-18
      相关资源
      最近更新 更多