Node to add two formats picture page

 

Format 1: Node add a picture with dataModel

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Node 用dataModel添加图片</title>
    <style>
        html, body {
            padding: 0px;
            margin: 0px;
        }
        .main {
            margin: 0px;
            padding: 0px;
            position: absolute;
            top: 0px;
            bottom: 0px;
            left: 0px;
            right: 0px;
        }
    </style>
    <script>
        htconfig = {
            Default: {
                toolTipDelay: 300
            }
        };
    </script>
    <script src="../../../../lib/core/ht.js"></script>

    <script type="text/javascript">
        //声明图片
        ht.Default.setImage("man", "../../../../picture/png/manPng/man.png");

        //初始化
        function init() {
            dataModel = new ht.DataModel();       g2d = new ht.graph.GraphView(dataModel);
            g2d.addToDOM();
            g2d.setEditable(true);
            view = g2d.getView();
            view.className = 'main';
            document.body.appendChild(view);
            addNode();
        function addNode () {
        // set the image size of the location
        }
     




            node = new ht.Node ();
            dataModel.add (Node) 
            node.setImage ( 'man'); 
            node.setPosition (800, 150); // Set the center coordinate position of the elements 
            node.setSize (200, 200); // setSize (width, height) size 
            return Node; 
        } 
    </ Script> 
</ head> 
<body> 
<body the onload = "the init ();"> </ body> 
</ body> 
</ HTML>

  

 

Format 2: Node with dm add pictures

<!DOCTYPE html>
<html>
<head>
    <title>Node 用dm添加图片</title>
    <style>
        .view {
            position: absolute;
            left: 0;
            right: 0;
            top: 0;
            bottom: 0;
        }
    </style>
    <script src="../../../../lib/core/ht.js"></script>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <script type="text/javascript">
        //声明图片
        ht.Default.setImage("man", "../../../../picture/png/manPng/man.png");
                DM = window.dm = graph.dm (),
        function the init () {

        // initialize
            var = Graph = window.graph new new ht.graph.GraphView (),
                = graph.getView View ();
 
            view.className = "View"; 
            document.body.appendChild (View); 

            the addNode (); 
        } 

        // set the image size of the location 
        function the addNode () { 
            var = new new Node ht.Node () ; 
            dm.add (Node); 
            node.setImage ( 'man'); 
            node.setPosition (800, 150); // set the center coordinate position of the elements 
            node.setSize (200, 200); // setSize (width, height) size 
        } 
    </ Script> 
</ head> 
<body the onload = "the init ();"> 
</ body> 
</ HTML>

  

Guess you like

Origin www.cnblogs.com/ynhk/p/10944031.html