Skip to content

Commit abcb833

Browse files
committed
fix: Measure tools remove highlight when deactivating.
1 parent 476a84f commit abcb833

File tree

4 files changed

+12
-134
lines changed

4 files changed

+12
-134
lines changed

src/Measurement/MeasureAngleTool.ts

Lines changed: 0 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -215,63 +215,6 @@ class MeasureAngleTool extends MeasureTool {
215215
}
216216
}
217217
}
218-
219-
/**
220-
*
221-
*
222-
* @param event - The event value
223-
onPointerMove(event: ZeaPointerEvent): void {
224-
// skip if the alt key is held. Allows the camera tool to work
225-
if (
226-
((event instanceof ZeaMouseEvent || event instanceof ZeaTouchEvent) && event.altKey) ||
227-
(event instanceof ZeaMouseEvent && event.button !== 0)
228-
)
229-
return
230-
231-
if (this.stage == 0) {
232-
if (event.intersectionData && event.intersectionData.geomItem instanceof GeomItem) {
233-
const geomItem = <GeomItem>event.intersectionData.geomItem
234-
if (this.checkSurface(geomItem)) {
235-
if (geomItem != this.highlightedItemA) {
236-
if (this.highlightedItemA) {
237-
this.highlightedItemA.removeHighlight(this.highlightedItemA_highlightKey, true)
238-
}
239-
this.highlightedItemA = geomItem
240-
this.highlightedItemA_componentId = event.intersectionData.componentId
241-
const color = this.colorParam.value
242-
color.a = 0.2
243-
this.highlightedItemA.addHighlight(this.highlightedItemA_highlightKey, color, true)
244-
}
245-
}
246-
} else {
247-
if (this.highlightedItemA) {
248-
this.highlightedItemA.removeHighlight(this.highlightedItemA_highlightKey, true)
249-
this.highlightedItemA = null
250-
}
251-
}
252-
} else if (this.stage == 1) {
253-
if (event.intersectionData && event.intersectionData.geomItem instanceof GeomItem) {
254-
const geomItem = <GeomItem>event.intersectionData.geomItem
255-
if (geomItem != this.highlightedItemA && geomItem != this.highlightedItemB && this.checkSurface(geomItem)) {
256-
if (this.highlightedItemB) {
257-
this.highlightedItemB.removeHighlight(this.highlightedItemB_highlightKey, true)
258-
}
259-
this.highlightedItemB = geomItem
260-
this.highlightedItemB_componentId = event.intersectionData.componentId
261-
262-
const color = this.colorParam.value.clone()
263-
color.a = 0.2
264-
this.highlightedItemB.addHighlight(this.highlightedItemB_highlightKey, color, true)
265-
}
266-
} else {
267-
if (this.highlightedItemB) {
268-
this.highlightedItemB.removeHighlight(this.highlightedItemB_highlightKey, true)
269-
this.highlightedItemB = null
270-
}
271-
}
272-
}
273-
}
274-
*/
275218
}
276219

277220
export { MeasureAngleTool }

src/Measurement/MeasureDistanceTool.ts

Lines changed: 0 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -152,67 +152,6 @@ class MeasureDistanceTool extends MeasureTool {
152152
}
153153
}
154154
}
155-
156-
/**
157-
*
158-
*
159-
* @param event - The event value
160-
onPointerMove(event: ZeaPointerEvent): void {
161-
// skip if the alt key is held. Allows the camera tool to work
162-
if (
163-
((event instanceof ZeaMouseEvent || event instanceof ZeaTouchEvent) && event.altKey) ||
164-
(event instanceof ZeaMouseEvent && event.button !== 0)
165-
) {
166-
return
167-
}
168-
169-
const color = this.colorParam.value
170-
color.a = 0.2
171-
if (this.stage == 0) {
172-
if (event.intersectionData && event.intersectionData.geomItem instanceof GeomItem) {
173-
const geomItem = <GeomItem>event.intersectionData.geomItem
174-
if (geomItem.hasParameter('CurveType') || geomItem.hasParameter('SurfaceType')) {
175-
if (geomItem != this.highlightedItemA) {
176-
if (this.highlightedItemA) {
177-
this.highlightedItemA.removeHighlight(this.highlightedItemA_highlightKey, true)
178-
}
179-
this.highlightedItemA = geomItem
180-
this.highlightedItemA.addHighlight(this.highlightedItemA_highlightKey, color, true)
181-
}
182-
}
183-
} else {
184-
if (this.highlightedItemA) {
185-
this.highlightedItemA.removeHighlight(this.highlightedItemA_highlightKey, true)
186-
this.highlightedItemA = null
187-
}
188-
}
189-
event.stopPropagation()
190-
} else if (this.stage == 1) {
191-
if (event.intersectionData && event.intersectionData.geomItem instanceof GeomItem) {
192-
const geomItem = <GeomItem>event.intersectionData.geomItem
193-
if (geomItem != this.highlightedItemA && geomItem != this.highlightedItemB) {
194-
if (geomItem.hasParameter('CurveType') || geomItem.hasParameter('SurfaceType')) {
195-
if (this.highlightedItemB) {
196-
this.highlightedItemB.removeHighlight(this.highlightedItemB_highlightKey, true)
197-
this.highlightedItemB = null
198-
}
199-
200-
this.highlightedItemB = geomItem
201-
this.highlightedItemB.addHighlight(this.highlightedItemB_highlightKey, color, true)
202-
}
203-
}
204-
} else {
205-
if (this.highlightedItemB) {
206-
this.highlightedItemB.removeHighlight(this.highlightedItemB_highlightKey, true)
207-
this.highlightedItemB = null
208-
}
209-
}
210-
211-
event.stopPropagation()
212-
}
213-
}
214-
215-
*/
216155
}
217156

218157
export { MeasureDistanceTool }

src/Measurement/MeasureTool.ts

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -84,19 +84,20 @@ class MeasureTool extends BaseTool {
8484
this.appData.renderer.getGLCanvas().style.cursor = this.prevCursor
8585
}
8686

87+
if (this.highlightedItemB) {
88+
this.highlightedItemB.removeHighlight(this.highlightedItemB_highlightKey, true)
89+
this.highlightedItemB = null
90+
}
91+
if (this.highlightedItemA) {
92+
this.highlightedItemA.removeHighlight(this.highlightedItemA_highlightKey, true)
93+
this.highlightedItemA = null
94+
}
95+
8796
if (this.stage != 0) {
8897
const parentItem = <TreeItem>this.measurement.getOwner()
8998
parentItem.removeChild(parentItem.getChildIndex(this.measurement))
9099
this.measurement = null
91100

92-
if (this.highlightedItemB) {
93-
this.highlightedItemB.removeHighlight(this.highlightedItemB_highlightKey, true)
94-
this.highlightedItemB = null
95-
}
96-
if (this.highlightedItemA) {
97-
this.highlightedItemA.removeHighlight(this.highlightedItemA_highlightKey, true)
98-
this.highlightedItemA = null
99-
}
100101
this.stage = 0
101102
}
102103
}

testing-e2e/measurement.html

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -171,19 +171,14 @@
171171
toolManager.registerTool('measureAngleTool', measureAngleTool)
172172
toolManager.registerTool('measureCenterDistancesTool', measureCenterDistancesTool)
173173
renderer.getViewport().setManipulator(toolManager)
174-
174+
175175
// Push the Camera Manipultor onto the base of the stack.
176176
toolManager.pushTool('cameraManipulator')
177177

178178
document.addEventListener('keydown', (e) => {
179179
switch (e.key) {
180-
case 'm':
181-
if (measurementOn) {
182-
setToolToCameraManipulator()
183-
return
184-
}
185-
setToolToMeasureDistanceTool()
186-
break
180+
case 'Escape':
181+
toggleMode(0)
187182
}
188183
})
189184

0 commit comments

Comments
 (0)