From 1fd62582bb4ba007a9760207f785ee8227e6ff11 Mon Sep 17 00:00:00 2001
From: liuyg <376836862@qq.com>
Date: Tue, 08 Jun 2021 08:38:04 +0800
Subject: [PATCH] 要素标绘
---
Zplot/js/plotPanelControl/colorpicker/js/colorpickerEditor.js | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 60 insertions(+), 0 deletions(-)
diff --git a/Zplot/js/plotPanelControl/colorpicker/js/colorpickerEditor.js b/Zplot/js/plotPanelControl/colorpicker/js/colorpickerEditor.js
new file mode 100644
index 0000000..b13dc51
--- /dev/null
+++ b/Zplot/js/plotPanelControl/colorpicker/js/colorpickerEditor.js
@@ -0,0 +1,60 @@
+$.extend($.fn.datagrid.defaults.editors, {
+ colorpicker: {//colorpicker就是你要自定义editor的名称
+ init: function (container, options) {
+ //var colorSector = $('<div id="colorSelector" class="colorSelector">').appendTo(container);
+ //$('#colorSelector').ColorPicker({
+ // color: '#0000ff',
+ // onShow: function (colpkr) {
+ // $(colpkr).fadeIn(500);
+ // return false;
+ // },
+ // onHide: function (colpkr) {
+ // $(colpkr).fadeOut(500);
+ // return false;
+ // },
+ // onChange: function (hsb, hex, rgb) {
+ // $('#colorSelector div').css('backgroundColor', '#' + hex);
+ // }
+ //});
+ //
+ //return $('#colorSelector div');
+ var input = $('<input>').appendTo(container);
+ input.ColorPicker({
+ color: '#0000ff',
+ onShow: function (colpkr) {
+ $(colpkr).fadeIn(500);
+ return false;
+ },
+ onHide: function (colpkr) {
+ $(colpkr).fadeOut(500);
+ return false;
+ },
+ onChange: function (hsb, hex, rgb) {
+ input.css('backgroundColor', '#' + hex);
+ input.val('0x' + hex);
+ }
+ });
+ return input;
+ },
+ getValue: function (target) {
+ return $(target).val().replace(/0x/, "#");
+ },
+ setValue: function (target, value) {
+ // 特殊处理, 因为在flash里使用的是0x16进制格式
+ value = value.replace(/0x/, "#");
+ $(target).val(value);
+ $(target).css('backgroundColor', value);
+ $(target).ColorPickerSetColor(value);
+ },
+ resize: function (target, width) {
+ var input = $(target);
+ if ($.boxModel == true) {
+ input.width(width - (input.outerWidth() - input.width()));
+ } else {
+ input.width(width);
+ }
+ }
+ }
+});
+
+
--
Gitblit v1.9.3