<commit_before>function WorldEditor(domElement) {
	this.domElement = domElement
	this.showEditorHelpers = true
	var active = false

	this.activate = function() {
		active = true
		this.cameraSelector.transformControls.enabled = true
		this.cameraSelector.editorControls.enabled = true
		this.showEditorHelpers = true
	}

	this.deactivate = function() {
		this.cameraSelector.transformControls.enabled = false
		this.cameraSelector.editorControls.enabled = false
		if (this.editorTree.parent) {
			this.editorTree.parent.remove(this.editorTree)
		}
		active = false
	}

	this.isActive = function() {
		return active
	}

	this.transformMode = 'translate'

	this.editorTree = new THREE.Object3D()

	// grid around origin along x, z axises
	this.gridHelper = new WorldEditorOriginGrid()

	// radial grid
	this.radialHelper = new WorldEditorRadialHelper()
	this.editorTree.add(this.radialHelper.mesh)

	// root for any selection bboxes
	this.selectionTree = new THREE.Object3D()
	this.editorTree.add(this.selectionTree)

	// root for 3d handles
	this.handleTree = new THREE.Object3D()
	this.editorTree.add(this.handleTree)

	this.cameraSelector = new WorldEditorCameraSelector(this.domElement)

	this.cameraHelper = new VRCameraHelper()

	var that = this

	this.setupObjectPicking()

	E2.ui.state.on('changed:modifyMode', this.setTransformMode.bind(this));
}

WorldEditor.prototype.setTransformMode = function(mode) {
	this.transformMode = mode
}

WorldEditor.prototype.update = function() {
	if (!this.isActive()) {
		return
	}

	// update the reference grid scale based on camera distance from target
	var f = function(v, n) {
		if (v / 10 < n) { return n }
		return f(v, n * 10)
	}

	var cameraDistanceToSelectedObject = this.cameraSelector.camera.position.clone().sub(this.cameraSelector.editorControls.center).length() || 1
	var gridScale = f(cameraDistanceToSelectedObject, 0.01)

	this.gridHelper.scale(gridScale)

	if (this.vrCamera) {
		this.radialHelper.position(this.vrCamera.position)

		var cameraDistanceToVRCamera = this.cameraSelector.camera.position.clone().sub(this.vrCamera.position).length() || 1
		var gridScale = f(cameraDistanceToVRCamera, 0.01)
		gridScale = gridScale < 1 ? 1 : gridScale
		this.radialHelper.scale(gridScale)
	}

	this.cameraSelector.update(this.transformMode)
}

WorldEditor.prototype.preRenderUpdate = function() {
	// add the editor tree to the scene if it's not there already
	var editorIdx = this.scene.children.indexOf(this.editorTree)

	if (this.showEditorHelpers && editorIdx < 0) {
		this.scene.add(this.editorTree)
	}
	else if (!this.showEditorHelpers && editorIdx >= 0) {
		this.scene.remove(this.editorTree)<commit_msg>make radial helper follow the vr camera again<commit_after>function WorldEditor(domElement) {
	this.domElement = domElement
	this.showEditorHelpers = true
	var active = false

	this.activate = function() {
		active = true
		this.cameraSelector.transformControls.enabled = true
		this.cameraSelector.editorControls.enabled = true
		this.showEditorHelpers = true
	}

	this.deactivate = function() {
		this.cameraSelector.transformControls.enabled = false
		this.cameraSelector.editorControls.enabled = false
		if (this.editorTree.parent) {
			this.editorTree.parent.remove(this.editorTree)
		}
		active = false
	}

	this.isActive = function() {
		return active
	}

	this.transformMode = 'translate'

	this.editorTree = new THREE.Object3D()

	// grid around origin along x, z axises
	this.gridHelper = new WorldEditorOriginGrid()

	// radial grid
	this.radialHelper = new WorldEditorRadialHelper()
	this.editorTree.add(this.radialHelper.mesh)

	// root for any selection bboxes
	this.selectionTree = new THREE.Object3D()
	this.editorTree.add(this.selectionTree)

	// root for 3d handles
	this.handleTree = new THREE.Object3D()
	this.editorTree.add(this.handleTree)

	this.cameraSelector = new WorldEditorCameraSelector(this.domElement)

	this.cameraHelper = new VRCameraHelper()

	var that = this

	this.setupObjectPicking()

	E2.ui.state.on('changed:modifyMode', this.setTransformMode.bind(this));
}

WorldEditor.prototype.setTransformMode = function(mode) {
	this.transformMode = mode
}

WorldEditor.prototype.update = function() {
	if (!this.isActive()) {
		return
	}

	// update the reference grid scale based on camera distance from target
	var f = function(v, n) {
		if (v / 10 < n) { return n }
		return f(v, n * 10)
	}

	var cameraDistanceToSelectedObject = this.cameraSelector.camera.position.clone().sub(this.cameraSelector.editorControls.center).length() || 1
	var gridScale = f(cameraDistanceToSelectedObject, 0.01)

	this.gridHelper.scale(gridScale)

	if (this.vrCamera) {
		this.radialHelper.position(this.vrCamera.parent.position)

		var cameraDistanceToVRCamera = this.cameraSelector.camera.position.clone().sub(this.vrCamera.position).length() || 1
		var gridScale = f(cameraDistanceToVRCamera, 0.01)
		gridScale = gridScale < 1 ? 1 : gridScale
		this.radialHelper.scale(gridScale)
	}

	this.cameraSelector.update(this.transformMode)
}

WorldEditor.prototype.preRenderUpdate = function() {
	// add the editor tree to the scene if it's not there already
	var editorIdx = this.scene.children.indexOf(this.editorTree)

	if (this.showEditorHelpers && editorIdx < 0) {
		this.scene.add(this.editorTree)
	}
	else if (!this.showEditorHelpers && editorIdx >= 0) {
		this.scene.remove(this.editorTree)
{'fraction_non_alphanumeric': 0.11148334263912153, 'fraction_numerical': 0.007816862088218872, 'mean_word_length': 4.592091571279917, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1203047', 'n_tokens_mistral': 1798, 'n_tokens_neox': 1669, 'n_words': 352}