12345678910111213141516171819202122232425262728293031323334353637383940 |
- import {EXPCAD as CAD} from './index'
- export interface Other{
- showLabel: () => void,
- hideLabel: () => void
- }
- // 附加走过路径的label
- export const other = (cad: CAD) => {
- let show = false
- let addProcessing = cad.addProcessing
- cad.addProcessing = (...args) => {
- let processing = addProcessing.call(cad, ...args)
- let addTagging = processing.addTagging
- processing.addTagging = (args) => {
- (args as any).show = show
- return addTagging.call(processing, args)
- }
-
- return processing
- }
-
- cad.hideLabel = () => {
- show = false
- cad.processings.forEach(processing => {
- processing.taggings.forEach(t => t.ele.show = show)
- })
- }
- cad.showLabel = () => {
- show = true
- cad.processings.forEach(processing => {
- processing.taggings.forEach(t => t.ele.show = show)
- })
- }
- }
|