2、Paper & Grid 縮略圖!

image.png
  • 定義縮略圖,兩個paper。
  • paperbackground屬性
  • interactive交互屬性、scale、translate
<link rel="stylesheet" type="text/css" href="/my/joint/joint.css" />    
<script src="/my/joint/jquery.js"></script>
<script src="/my/joint/lodash.js"></script>
<script src="/my/joint/backbone.js"></script>
<script src="/my/joint/joint.js"></script>

<div style="position: relative; padding-bottom: 100px;">
    <div class="paper" id="paper-multiple-papers" style="position: absolute;"></div>
    <div class="paper" id="paper-multiple-papers-small" style="position: absolute; top: 75px; left: 450px;"></div>
</div>

<script>    
    var graph = new joint.dia.Graph;
    
    var paper = new joint.dia.Paper({
        el: document.getElementById('paper-multiple-papers'),
        model: graph,
        width: 600,
        height: 100,
        gridSize: 1,
        background: {
            color: 'rgba(0, 255, 0, 0.3)'
        }
    });

    var paperSmall = new joint.dia.Paper({
        el: document.getElementById('paper-multiple-papers-small'),
        model: graph,
        width: 150,
        height: 25,
        gridSize: 1,
        interactive: false
    });
    paperSmall.scale(0.25);

    /* paper.scale(0.5, 0.5);
    paper.translate(300, 50); */

    var rect = new joint.shapes.standard.Rectangle();
    rect.position(100, 30);
    rect.resize(100, 40);
    rect.attr({
        body: {
            fill: 'blue'
        },
        label: {
            text: 'hello',
            fill: 'white'
        }
    });

    rect.addTo(graph);

    var rect2 = rect.clone();
    rect2.translate(300, 0);
    rect2.attr('label/text', 'world!');
    rect2.addTo(graph);

    var link = new joint.shapes.standard.Link();
    link.source(rect);
    link.target(rect2);
    link.addTo(graph);
</script>

參考
Joint tutorial

?著作權歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務。

相關閱讀更多精彩內(nèi)容

  • 選擇qi:是表達式 標簽選擇器 類選擇器 屬性選擇器 繼承屬性: color,font,text-align,li...
    love2013閱讀 2,436評論 0 11
  • **2014真題Directions:Read the following text. Choose the be...
    又是夜半驚坐起閱讀 11,090評論 0 23
  • Mobile Web Favorites 參與貢獻 移動前端開發(fā)收藏夾,歡迎使用Issues以及 Pull Req...
    柴東啊閱讀 954評論 0 2
  • 夜深了 我坐在窗前 望著寂靜的天空 耳邊偶爾有幾聲犬吠 和寒風呼嘯的聲音 我望著那輪明月,想 她會不會很孤獨 當然...
    k堅持閱讀 125評論 0 0
  • 堅持,讓被動變主動 (12月11日) 人是一種很奇怪的生物,想法會根據(jù)時間、地點、環(huán)境的變化而不斷的改變~ 開始書...
    明天過后便是晴天閱讀 1,312評論 1 19

友情鏈接更多精彩內(nèi)容