@liquidcars/atlas 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -0
- package/dist/liquidcars-atlas.js +5 -4
- package/dist/liquidcars-atlas.js.map +1 -1
- package/package.json +1 -1
- package/src/diagram-webgl.js +3 -2
- package/src/liquidcars-atlas.js +1 -0
package/package.json
CHANGED
package/src/diagram-webgl.js
CHANGED
|
@@ -28,7 +28,7 @@ export function installPlanarAtlas(Atlas,OrthographicCamera,computeLayout,G){
|
|
|
28
28
|
.diagram-appearance{padding:6px 9px;display:grid;gap:8px;color:#dbe7ec;font-size:12px}.diagram-appearance label{display:flex;gap:8px;align-items:center}`;
|
|
29
29
|
this.shadowRoot.append(style);
|
|
30
30
|
const diagram=this.diagramView,setState=diagram.setState.bind(diagram),action=diagram.action.bind(diagram);
|
|
31
|
-
diagram.setState=(value={})=>setState(diagramViewForModel(value,this._canonicalDiagramCenter(),value
|
|
31
|
+
diagram.setState=(value={})=>setState(diagramViewForModel(value,this._canonicalDiagramCenter(),value?.orbitId?this._diagramOrbitTarget(value.orbitId):null));
|
|
32
32
|
diagram.refresh=()=>{if(!this._webglPlanar)return false;this._scheduleDiagram();return true;};
|
|
33
33
|
diagram.scheduleRefresh=()=>{if(this._webglPlanar)this._scheduleDiagram();};
|
|
34
34
|
diagram.focusSelection=()=>this.focusSelection();
|
|
@@ -137,6 +137,7 @@ export function installPlanarAtlas(Atlas,OrthographicCamera,computeLayout,G){
|
|
|
137
137
|
};
|
|
138
138
|
proto.getCameraView=function(){return this._webglPlanar?{position:[this.focus.x,this.focus.y,1000],target:[this.focus.x,this.focus.y,0],zoom:this.zoom,projection:'orthographic'}:original.getCameraView.call(this);};
|
|
139
139
|
proto.setCameraView=function(view={},options={}){
|
|
140
|
+
if(!view||typeof view!=='object')return this;
|
|
140
141
|
if(!this._webglPlanar)return original.setCameraView.call(this,view,options);
|
|
141
142
|
this._diagramFitted=false;
|
|
142
143
|
if(view.target?.length===3&&view.target.every(Number.isFinite))this.targetFocus.set(view.target[0],view.target[1],0);if(Number.isFinite(view.zoom)&&view.zoom>0)this.targetZoom=Math.max(.001,Math.min(6,view.zoom));
|
|
@@ -159,7 +160,7 @@ export function installPlanarAtlas(Atlas,OrthographicCamera,computeLayout,G){
|
|
|
159
160
|
proto._positionJumpButton=function(){if(!this._webglPlanar)return original._positionJumpButton.call(this);const mode=this.viewMode;this.viewMode='3d';try{return original._positionJumpButton.call(this);}finally{this.viewMode=mode;}};
|
|
160
161
|
proto.getDiagramView=function(){const state=this.diagramView.captureState();return {...state,cameraModelCenter:this._canonicalDiagramCenter(),viewport:this._webglPlanar?{...this.getCameraView(),fitted:this._diagramFitted}:state.viewport};};
|
|
161
162
|
proto.captureDiagramView=function(){return this.getDiagramView();};
|
|
162
|
-
proto.setDiagramView=function(state={}){this.diagramView.setState(state);if(this._webglPlanar&&state.viewport?.projection==='orthographic'){this._diagramFitted=false;this.setCameraView(state.viewport,{animate:false});this._diagramFitted=state.viewport.fitted===true;}return this;};
|
|
163
|
+
proto.setDiagramView=function(state={}){state??={};this.diagramView.setState(state);if(this._webglPlanar&&state.viewport?.projection==='orthographic'){this._diagramFitted=false;this.setCameraView(state.viewport,{animate:false});this._diagramFitted=state.viewport.fitted===true;}return this;};
|
|
163
164
|
proto._renderFrame=function(time){const start=performance.now(),result=original._renderFrame.call(this,time);if(this._webglPlanar){this.dataset.frameMs=(performance.now()-start).toFixed(2);this.dataset.frames=String((Number(this.dataset.frames)||0)+1);this.dataset.drawCalls=String(this.renderer?.info.render.calls||0);}return result;};
|
|
164
165
|
proto.captureFrame=function(options={}){return original.captureFrame.call(this,this._webglPlanar&&options.background==='theme'?{...options,background:this.diagramView.config.background||(this.diagramView.config.theme==='dark'?'#2d2f31':'#f5f5f5')}:options);};
|
|
165
166
|
proto.exportDiagramSvg=function(options={}){this.dataset.svgExports=String((Number(this.dataset.svgExports)||0)+1);if(this._webglPlanar)return this._withCanonicalDiagram(()=>original.exportDiagramSvg.call(this,{...this._diagramOptions(),...options}));return original.exportDiagramSvg.call(this,options);};
|
package/src/liquidcars-atlas.js
CHANGED
|
@@ -2895,6 +2895,7 @@ class LiquidCarsAtlas extends HTMLElement {
|
|
|
2895
2895
|
}
|
|
2896
2896
|
|
|
2897
2897
|
setCameraView(view = {}, options = {}) {
|
|
2898
|
+
if (!view || typeof view !== "object") return this;
|
|
2898
2899
|
const position = Array.isArray(view.position) && view.position.length === 3 && view.position.every(Number.isFinite)
|
|
2899
2900
|
? new THREE.Vector3().fromArray(view.position)
|
|
2900
2901
|
: null;
|