页面分离修改
This commit is contained in:
@ -5,6 +5,7 @@ import Draw from '../../../Draw/draw'
|
||||
import MouseTip from '../../../MouseTip'
|
||||
import MouseEvent from '../../../Event'
|
||||
import Dialog from '../../../BaseDialog';
|
||||
import Tools from "../../../Tools";
|
||||
import EventBinding from '../../Element/Dialog/eventBinding';
|
||||
import { html } from "./_element";
|
||||
import { CameraController } from '../../../Global/global'
|
||||
@ -12,7 +13,7 @@ import { CameraController } from '../../../Global/global'
|
||||
class Graffiti extends Draw {
|
||||
/**
|
||||
* @constructor
|
||||
* @param sdk
|
||||
* @param sdk
|
||||
* @description 涂鸦
|
||||
* @param options {object} 线属性
|
||||
* @param options.width=10{number} 宽度
|
||||
@ -23,6 +24,7 @@ class Graffiti extends Draw {
|
||||
this.options.width = options.width || 1
|
||||
this.options.color = options.color || '#ff0000'
|
||||
this._elms = {};
|
||||
this.tools = new Tools(sdk)
|
||||
this._EventBinding = new EventBinding()
|
||||
Graffiti.edit(this, true)
|
||||
}
|
||||
@ -31,7 +33,7 @@ class Graffiti extends Draw {
|
||||
return this.options.color
|
||||
}
|
||||
set color(v) {
|
||||
if(!this.options.color) {
|
||||
if (!this.options.color) {
|
||||
return
|
||||
}
|
||||
this.options.color = v
|
||||
@ -69,14 +71,15 @@ class Graffiti extends Draw {
|
||||
// 编辑框
|
||||
static async edit(that, state) {
|
||||
if (state) {
|
||||
that._DialogObject = await new Dialog(that.sdk.viewer._container, {
|
||||
title: '涂鸦参数',
|
||||
})
|
||||
await that._DialogObject.init()
|
||||
let contentElm = document.createElement('div');
|
||||
contentElm.innerHTML = html()
|
||||
that._DialogObject.contentAppChild(contentElm)
|
||||
// that._DialogObject = await new Dialog(that.sdk.viewer._container, {
|
||||
// title: '涂鸦参数',
|
||||
// })
|
||||
// await that._DialogObject.init()
|
||||
// let contentElm = document.createElement('div');
|
||||
// contentElm.innerHTML = html()
|
||||
// that._DialogObject.contentAppChild(contentElm)
|
||||
// 颜色组件
|
||||
let contentElm = document.getElementsByClassName('graffiti')[0]
|
||||
let colorPicker = new YJColorPicker({
|
||||
el: contentElm.getElementsByClassName("color")[0],
|
||||
size: 'mini',//颜色box类型
|
||||
@ -91,20 +94,20 @@ class Graffiti extends Draw {
|
||||
that.color = 'rgba(255,255,255,1)'
|
||||
},//点击清空按钮事件回调
|
||||
})
|
||||
that._DialogObject._element.body.className = that._DialogObject._element.body.className + ' graffiti'
|
||||
// that._DialogObject._element.body.className = that._DialogObject._element.body.className + ' graffiti'
|
||||
let all_elm = contentElm.getElementsByTagName("*")
|
||||
that._EventBinding.on(that, all_elm)
|
||||
that._elms = that._EventBinding.element
|
||||
that._elms.color = [colorPicker]
|
||||
|
||||
let confirmBtn = document.createElement('button');
|
||||
confirmBtn.className = 'confirm';
|
||||
confirmBtn.innerHTML = '确认'
|
||||
that._DialogObject.footAppChild(confirmBtn)
|
||||
confirmBtn.addEventListener('click', () => {
|
||||
that.start()
|
||||
Graffiti.edit(that, false)
|
||||
});
|
||||
// let confirmBtn = document.createElement('button');
|
||||
// confirmBtn.className = 'confirm';
|
||||
// confirmBtn.innerHTML = '确认'
|
||||
// that._DialogObject.footAppChild(confirmBtn)
|
||||
// confirmBtn.addEventListener('click', () => {
|
||||
// that.start()
|
||||
// Graffiti.edit(that, false)
|
||||
// });
|
||||
}
|
||||
else {
|
||||
if (that._DialogObject && that._DialogObject.close) {
|
||||
@ -122,7 +125,7 @@ class Graffiti extends Draw {
|
||||
start() {
|
||||
let _this = this
|
||||
if (YJ.Measure.GetMeasureStatus()) {
|
||||
console.log('上一次测量未结束')
|
||||
this.tools.message({ type: 'warning', text: '上一次测量未结束' })
|
||||
} else {
|
||||
let viewer = this.sdk.viewer
|
||||
CameraController(this.sdk, false)
|
||||
@ -160,7 +163,7 @@ class Graffiti extends Draw {
|
||||
})
|
||||
})
|
||||
this.event.mouse_left_up((movement, cartesian) => {
|
||||
polylineArray[polylineArray.length-1].polyline.positions = positions
|
||||
polylineArray[polylineArray.length - 1].polyline.positions = positions
|
||||
this.event.mouse_move((movement, cartesian) => {
|
||||
this.tip.setPosition(
|
||||
cartesian,
|
||||
@ -221,7 +224,7 @@ class Graffiti extends Draw {
|
||||
}
|
||||
}
|
||||
|
||||
flicker() {}
|
||||
flicker() { }
|
||||
}
|
||||
|
||||
export default Graffiti
|
||||
|
||||
Reference in New Issue
Block a user