The lines are being created in vwf(which might be a reason why it’s slower), so the creation is in several places. Patrick suggested profiling, which is the next step to really understanding what is going on. At this point, I’ve got other issues to work on, and speeding things up is more of a nice to have.
https://github.com/virtual-world-framework/vwf/tree/development
support/client/lib/vwf/view/cesium.js - mouse events captured, and dispatched out
// left up
mouse.setInputAction( function( movement ) {
self.state.mouse.leftDown = false;
var eData = pick( “left”, 0, “up”, movement.position );
if ( downID !== undefined ) {
self.kernel.dispatchEvent( downID, “pointerUp”, eData.eventData, eData.eventNodeData );
}
self.state.mouse.leftDownID = undefined;
}, Cesium.ScreenSpaceEventType.LEFT_UP );
// left down
mouse.setInputAction( function( movement ) {
self.state.mouse.leftDown = true;
var eData = pick( “left”, 0, “down”, movement.position );
self.kernel.dispatchEvent( downID, “pointerDown”, eData.eventData, eData.eventNodeData );
}, Cesium.ScreenSpaceEventType.LEFT_DOWN );
// mouse move
mouse.setInputAction( function( movement ) {
var bd = self.state.mouse.buttonDown();
if ( bd ) {
var eData = pick( bd, 0, “drag”, movement.endPosition );
self.kernel.dispatchEvent( downID, “pointerMove”, eData.eventData, eData.eventNodeData );
} else {
var eData = pick( “”, 0, “move”, movement.endPosition );
if ( lastOverID === undefined && overID !== undefined ) {
self.kernel.dispatchEvent( overID, “pointerEnter”, eData.eventData, eData.eventNodeData );
lastOverID = overID;
} else if ( overID ) {
if ( overID !== lastOverID ) {
self.kernel.dispatchEvent( lastOverID, “pointerLeave”, eData.eventData, eData.eventNodeData );
self.kernel.dispatchEvent( overID, “pointerEnter”, eData.eventData, eData.eventNodeData );
lastOverID = overID;
} else {
self.kernel.dispatchEvent( overID, “pointerOver”, eData.eventData, eData.eventNodeData );
}
}
}
}, Cesium.ScreenSpaceEventType.MOUSE_MOVE );
public/cesium-webrtc/index.vwf.yaml - mouse events are implemented and sends a create, this is the root/application file
this.pointerDown = function( pointerInfo, pickInfo ) {
switch ( pointerInfo.button ) {
case “left”:
switch ( this.toolbar.inputMode ) {
case “draw”:
if ( pickInfo && pickInfo.globalPosition ) {
this.lastDrawPoint = { pickInfo: pickInfo };
} else {
this.lastDrawPoint = undefined;
}
break;
}
break;
}
}
this.pointerMove = function( pointerInfo, pickInfo ) {
switch ( pointerInfo.button ) {
case “left”:
switch ( this.toolbar.inputMode ) {
case “draw”:
if ( pickInfo.globalPosition ) {
var dist = this.distanceFromLast( pickInfo );
console.info( "dist = " + dist + " this.minDistanceSquared = " + this.minDistanceSquared );
if ( dist > this.minDistanceSquared ) {
this.draw( pickInfo )
}
}
break;
}
break;
}
}
this.pointerUp = function( pointerInfo, pickInfo ) {
switch ( this.toolbar.inputMode ) {
case “draw”:
if ( pickInfo.globalPosition ) {
this.draw( pickInfo )
}
break;
}
this.lastDrawPoint = undefined;
this.polyLineCollection = undefined;
}
support/client/lib/vwf/model/cesium.js - actual creation in creatingNode function, see below
this.state.nodes[ childID ] = node = createNode();
sceneNode = findSceneNode.call( this, node );
parentNode = findParent.call( this, nodeID );
if ( parentNode && parentNode.cesiumObj instanceof Cesium.DynamicObject ) {
node.cesiumObj = parentNode.cesiumObj.polyline;
} else {
var primitives = sceneNode.scene.getPrimitives();
if ( parentNode.cesiumObj && parentNode.cesiumObj instanceof Cesium.PolylineCollection ) {
node.polylineCollection = parentNode.cesiumObj;
}
if ( node.polylineCollection === undefined ) {
node.polylineCollection = new Cesium.PolylineCollection();
}
node.cesiumObj = node.polylineCollection.add( childSource );
if ( !primitives.contains( node.polylineCollection ) ) {
primitives.add( node.polylineCollection );
}
node.cesiumObj.vwfID = childID;
}
node.scene = sceneNode.scene;
Scott