网站开发实习过程,做网站市场价格多少,网站建设费摊销,网站建设静态部分实训总结示例地址#xff1a;
http://mars3d.cn/editor-vue.html?idgraphic/primitive/point
当前问题#xff1a;
右键编辑点#xff0c;开始编辑对象--停止编辑。需要保存编辑后的点到数据库#xff0c;需要对应的停止编辑函数。 {text: 停止编辑对象,icon:
http://mars3d.cn/editor-vue.html?idgraphic/primitive/point
当前问题
右键编辑点开始编辑对象--停止编辑。需要保存编辑后的点到数据库需要对应的停止编辑函数。 {text: 停止编辑对象,icon: fa fa-edit,show: function (e) { console.log(停止编辑对象获取对象信息);const graphic e.graphicif (!graphic || !graphic.hasEdit) {return false}return graphic.isEditing},callback: (e) {console.log(停止编辑对象000callback);const graphic e.graphicif (!graphic) {return false}if (graphic) {graphic.stopEditing()}}},
解决方案
停止编辑后能够获取编辑点的坐标、高度、属性信息回传给后端保存。
1.可以使用下面事件监听。
graphicLayer.on(mars3d.EventType.editStop, function (e) {})2.或参考图上标绘功能增加其他事件做完整的处理。
// 矢量数据创建完成graphicLayer.on(mars3d.EventType.drawCreated, function (e) {if (formState.hasEdit || props.customEditor) {showEditor(e.graphic)}})// 单击开始编辑graphicLayer.on(mars3d.EventType.editStart, (e: any) {setTimeout(() {// 属性面板打开时点击其他的矢量数据打开后会被下面的执行关闭showEditor(e.graphic)}, 150)})// 修改了矢量数据graphicLayer.on([mars3d.EventType.editMovePoint, mars3d.EventType.editStyle, mars3d.EventType.editRemovePoint], function (e) {updateWidget(graphic-editor, {data: {graphic: markRaw(e.graphic)}})})// 停止编辑graphicLayer.on([mars3d.EventType.editStop, mars3d.EventType.removeGraphic], function (e) {setTimeout(() {if (!graphicLayer.isEditing) {if (props.customEditor) {emit(onStopEditor)} else {disable(graphic-editor)}}}, 100)})