LegacyViewer now uses an adhoc extended SelectionExtension which has it's object clicked handler disabled
This commit is contained in:
Родитель
7943ad1ed4
Коммит
c5a971f9de
|
@ -22,7 +22,8 @@ import {
|
|||
TreeNode,
|
||||
SpeckleLoader,
|
||||
DefaultViewerParams,
|
||||
ViewerParams
|
||||
ViewerParams,
|
||||
SelectionEvent
|
||||
} from '..'
|
||||
import { FilteringExtension, FilteringState } from './extensions/FilteringExtension'
|
||||
import { PolarView } from './extensions/core-extensions/Providers'
|
||||
|
@ -31,6 +32,16 @@ import { Queries } from './queries/Queries'
|
|||
import { Query, QueryArgsResultMap } from './queries/Query'
|
||||
import { DataTreeBuilder } from './tree/DataTree'
|
||||
|
||||
class LegacySelectionExtension extends SelectionExtension {
|
||||
/** FE2 'manually' selects objects pon it's own, so we're disabling the extension's event handler
|
||||
* Note: FE2 shouldn't do that, unless it plans on properly extending the SelectionExtension, but we're doing it like this
|
||||
* for now in order to reduce the impact on the FE's codebase with the introduction of the new viewer API
|
||||
*/
|
||||
protected onObjectClicked(selection: SelectionEvent) {
|
||||
selection
|
||||
}
|
||||
}
|
||||
|
||||
export class LegacyViewer extends Viewer {
|
||||
private cameraController: CameraController = null
|
||||
private selection: SelectionExtension = null
|
||||
|
@ -47,7 +58,7 @@ export class LegacyViewer extends Viewer {
|
|||
) {
|
||||
super(container, params)
|
||||
this.cameraController = this.createExtension(CameraController)
|
||||
this.selection = this.createExtension(SelectionExtension)
|
||||
this.selection = this.createExtension(LegacySelectionExtension)
|
||||
this.sections = this.createExtension(SectionTool)
|
||||
this.sectionOutlines = this.createExtension(SectionOutlines)
|
||||
this.measurements = this.createExtension(MeasurementsExtension)
|
||||
|
|
|
@ -12,12 +12,13 @@ import Materials, {
|
|||
RenderMaterial
|
||||
} from '../materials/Materials'
|
||||
import { TreeNode } from '../tree/WorldTree'
|
||||
|
||||
export interface SelectionExtensionOptions {
|
||||
selectionMaterialData: RenderMaterial & DisplayStyle & MaterialOptions
|
||||
hoverMaterialData?: RenderMaterial & DisplayStyle & MaterialOptions
|
||||
}
|
||||
|
||||
const DefaultSelectionExtensionOptions = {
|
||||
const DefaultSelectionExtensionOptions: SelectionExtensionOptions = {
|
||||
selectionMaterialData: {
|
||||
id: MathUtils.generateUUID(),
|
||||
color: 0x047efb,
|
||||
|
|
Загрузка…
Ссылка в новой задаче