diff --git a/.gitignore b/.gitignore index 6e92f57..e8f7aaf 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ +node_modules tags diff --git a/index.html b/index.html index 53fdc00..dddf4c6 100644 --- a/index.html +++ b/index.html @@ -3,10 +3,16 @@ + + Profile Viewer -

Hello, world!

+ +
+ +
+ diff --git a/package.json b/package.json index f8d4b6c..e7f1add 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "profile-viewer", "version": "0.1.0", "description": "Profile viewer for behavior tree", - "main": "main.js", + "main": "./script/main.js", "scripts": { "test": "echo \"Error: no test specified\" && exit 1" }, @@ -18,6 +18,7 @@ "homepage": "https://github.com/adonis0147/profile-viewer#readme", "dependencies": { "bootstrap": "^3.3.7", + "d3": "^4.7.1", "jquery": "^3.1.1" } } diff --git a/main.js b/script/main.js similarity index 75% rename from main.js rename to script/main.js index 28d4d6f..19efa1a 100644 --- a/main.js +++ b/script/main.js @@ -5,7 +5,7 @@ let win function createWindow() { win = new BrowserWindow({width: 800, height: 600}) - win.loadURL(path.join('file://', __dirname, 'index.html')) + win.loadURL(path.join('file://', __dirname, '..', 'index.html')) } app.on('ready', createWindow) diff --git a/script/view.js b/script/view.js new file mode 100644 index 0000000..4a50b1a --- /dev/null +++ b/script/view.js @@ -0,0 +1,28 @@ +const d3 = require('d3') + +var blackboard = d3.select('#blackboard') + +init() + +function init() { + initBlackboard() + registerEvent() +} + +function initBlackboard() { + var min_width = blackboard.style('width') + var min_height = blackboard.style('height') + + blackboard.style('min-width', min_width) + blackboard.style('min-height', min_height) +} + +function registerEvent() { + d3.select(window).on('resize', () => { + console.log('Windows was resized to ' + + blackboard.style('width') + + ' x ' + + blackboard.style('height')) + }) +} + diff --git a/static/css/view.css b/static/css/view.css new file mode 100644 index 0000000..f129701 --- /dev/null +++ b/static/css/view.css @@ -0,0 +1,43 @@ +* { + padding: 0; + margin: 0; +} + +html { + display: flex; + flex-direction: column; + flex-grow: 1; + flex-shrink: 0; + height: 100%; + width: 100%; +} + +body { + display: flex; + flex-direction: row; + flex-grow: 1; + flex-shrink: 0; +} + +#sidebar { + background-color: #CCF; + padding: 10px; + width: 200px; + flex: none; +} + +#content { + background-color: #CFC; + padding: 10px; + display: flex; + flex-direction: column; + flex-grow: 1; +} + +svg { + border: 1px solid #0E0; + flex-grow: 1; + width: 100%; + height: 100%; +} +