export flow
This commit is contained in:
@@ -74,30 +74,36 @@ class BZgrafloweditor extends Buildoz{
|
||||
fillconsole(){
|
||||
this.slidePane.innerHTML = `
|
||||
<div class="inner-console">
|
||||
<button data-trigger="onAutoplace1H">Auto-place Horizontal</button>
|
||||
<button data-trigger="onAutoplace1V">Auto-place Vertical</button>
|
||||
<div class="cols-2"><label>GapX</label><input name="gapx" type="number" size="2" value="80"></div>
|
||||
<div class="cols-2"><label>GapY</label><input name="gapy" type="number" size="2" value="80"></div>
|
||||
<div class="cols-2">
|
||||
<label>Alignment</label>
|
||||
<bz-select name="align">
|
||||
<option value="center" selected>Center</option>
|
||||
<option value="first">First</option>
|
||||
<option value="last">Last</option>
|
||||
<option value="parent">Parent</option>
|
||||
</bz-select>
|
||||
</div>
|
||||
<div class="cols-2">
|
||||
<label>Wire Type</label>
|
||||
<bz-select name="wiretype">
|
||||
<option value="ortho">Ortho</option>
|
||||
<option value="straight">Straight</option>
|
||||
<option value="bezier" selected>Bezier</option>
|
||||
</bz-select>
|
||||
</div>
|
||||
<div class="cols-2"><label>Tension</label><input name="tension" type="number" size="2" value="30"></div>
|
||||
<section>
|
||||
<button data-trigger="onAutoplace1H">Auto-place Horizontal</button>
|
||||
<button data-trigger="onAutoplace1V">Auto-place Vertical</button>
|
||||
<div class="cols-2"><label>GapX</label><input name="gapx" type="number" size="2" value="80"></div>
|
||||
<div class="cols-2"><label>GapY</label><input name="gapy" type="number" size="2" value="80"></div>
|
||||
<div class="cols-2">
|
||||
<label>Alignment</label>
|
||||
<bz-select name="align">
|
||||
<option value="center" selected>Center</option>
|
||||
<option value="first">First</option>
|
||||
<option value="last">Last</option>
|
||||
<option value="parent">Parent</option>
|
||||
</bz-select>
|
||||
</div>
|
||||
<div class="cols-2">
|
||||
<label>Wire Type</label>
|
||||
<bz-select name="wiretype">
|
||||
<option value="ortho">Ortho</option>
|
||||
<option value="straight">Straight</option>
|
||||
<option value="bezier" selected>Bezier</option>
|
||||
</bz-select>
|
||||
</div>
|
||||
<div class="cols-2"><label>Tension</label><input name="tension" type="number" size="2" value="30"></div>
|
||||
</section>
|
||||
<section>
|
||||
<button data-trigger="onexportFlow">Export Flow</button>
|
||||
</section>
|
||||
</div>
|
||||
`
|
||||
this.slidePane.querySelector('button[data-trigger="onexportFlow"]').addEventListener('click', this.onexportFlow.bind(this))
|
||||
}
|
||||
|
||||
refreshNodes(e){
|
||||
@@ -151,5 +157,21 @@ class BZgrafloweditor extends Buildoz{
|
||||
this.graflow.refresh()
|
||||
})
|
||||
}
|
||||
|
||||
onexportFlow(e){
|
||||
const flowDeep = JSON.parse(JSON.stringify(this.graflow.flow))
|
||||
delete flowDeep.longLinks
|
||||
const exportObj = {
|
||||
nodesFile: this.getBZAttribute('nodes'),
|
||||
flow: flowDeep
|
||||
}
|
||||
const flowJson = JSON.stringify(exportObj, null, 2)
|
||||
const flowBlob = new Blob([flowJson], { type: 'application/json' })
|
||||
const flowUrl = URL.createObjectURL(flowBlob)
|
||||
const flowLink = document.createElement('a')
|
||||
flowLink.href = flowUrl
|
||||
flowLink.download = 'flow.json'
|
||||
flowLink.click()
|
||||
}
|
||||
}
|
||||
Buildoz.define('grafloweditor', BZgrafloweditor)
|
||||
Reference in New Issue
Block a user