fix selection override
This commit is contained in:
		@ -327,6 +327,11 @@ export const ModelingMachineProvider = ({
 | 
			
		||||
              )
 | 
			
		||||
            updateSceneObjectColors()
 | 
			
		||||
 | 
			
		||||
            // side effect to stop code mirror from updating the same selections again
 | 
			
		||||
            editorManager.lastSelection = selections.codeBasedSelections
 | 
			
		||||
              .map(({ range }) => `${range[1]}->${range[1]}`)
 | 
			
		||||
              .join('&')
 | 
			
		||||
 | 
			
		||||
            return {
 | 
			
		||||
              selectionRanges: selections,
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
@ -23,7 +23,7 @@ export default class EditorManager {
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  private _lastSelectionEvent: number | null = null
 | 
			
		||||
  private _lastSelection: string = ''
 | 
			
		||||
  lastSelection: string = ''
 | 
			
		||||
  private _lastEvent: { event: string; time: number } | null = null
 | 
			
		||||
 | 
			
		||||
  private _modelingSend: (eventInfo: ModelingMachineEvent) => void = () => {}
 | 
			
		||||
@ -199,12 +199,14 @@ export default class EditorManager {
 | 
			
		||||
      viewUpdate?.state?.selection?.ranges || []
 | 
			
		||||
    )
 | 
			
		||||
 | 
			
		||||
    if (selString === this._lastSelection) {
 | 
			
		||||
    if (selString === this.lastSelection) {
 | 
			
		||||
      // onUpdate is noisy and is fired a lot by extensions
 | 
			
		||||
      // since we're only interested in selections changes we can ignore most of these.
 | 
			
		||||
      return
 | 
			
		||||
    }
 | 
			
		||||
    this._lastSelection = selString
 | 
			
		||||
    // note this is also set from the "Set selection" action to stop code mirror from updating selections right after
 | 
			
		||||
    // selections are made from the scene
 | 
			
		||||
    this.lastSelection = selString
 | 
			
		||||
 | 
			
		||||
    if (
 | 
			
		||||
      this._lastSelectionEvent &&
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user