-

+ return `
+
+
+
`;
},
+ getSliderHtml: function() {
+ let imageText = locale().imageText;
+
+ return `
+
+ ${imageText.imageSetting}
+
+
+
+
+
+
+
${imageText.conventional}
+
+
+
+
+
+
+
+
${imageText.border}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
`;
+ },
+ sliderHtmlShow: function() {
+ let _this = this;
+
+ $("#luckysheet-modal-dialog-slider-imageCtrl").remove();
+
+ let sliderHtml = _this.getSliderHtml();
+ $("body").append(sliderHtml);
+ luckysheetsizeauto();
+
+ let imgItem = _this.images[_this.currentImgId];
+
+ //类型
+ let type = imgItem.type;
+ $("#luckysheet-modal-dialog-slider-imageCtrl #imgItemType" + type).prop("checked", true);
+
+ //固定位置
+ let isFixedPos = imgItem.isFixedPos;
+ $("#luckysheet-modal-dialog-slider-imageCtrl #imgItemIsFixedPos").prop("checked", isFixedPos);
+
+ //边框宽度
+ let border = imgItem.border;
+ $("#luckysheet-modal-dialog-slider-imageCtrl #imgItemBorderWidth").val(border.width);
+ $("#luckysheet-modal-dialog-slider-imageCtrl #imgItemBorderRadius").val(border.radius);
+ $("#luckysheet-modal-dialog-slider-imageCtrl #imgItemBorderStyle").val(border.style);
+ $("#luckysheet-modal-dialog-slider-imageCtrl #imgItemBorderColor span").css("background-color", border.color).attr("title", border.color);
+
+ _this.init();
+ },
+ colorSelectDialog: function(currenColor){
+ const _locale = locale();
+ const locale_button = _locale.button;
+ const locale_toolbar = _locale.toolbar;
+
+ $("#luckysheet-modal-dialog-mask").show();
+ $("#luckysheet-imageCtrl-colorSelect-dialog").remove();
+
+ $("body").append(replaceHtml(modelHTML, {
+ "id": "luckysheet-imageCtrl-colorSelect-dialog",
+ "addclass": "luckysheet-imageCtrl-colorSelect-dialog",
+ "title": "图片边框颜色选择",
+ "content": `
+ 当前颜色:
+
+
`,
+ "botton": `
+
`,
+ "style": "z-index:100003"
+ }));
+ let $t = $("#luckysheet-imageCtrl-colorSelect-dialog")
+ .find(".luckysheet-modal-dialog-content")
+ .css("min-width", 300)
+ .end(),
+ myh = $t.outerHeight(),
+ myw = $t.outerWidth();
+ let winw = $(window).width(), winh = $(window).height();
+ let scrollLeft = $(document).scrollLeft(), scrollTop = $(document).scrollTop();
+ $("#luckysheet-imageCtrl-colorSelect-dialog").css({
+ "left": (winw + scrollLeft - myw) / 2,
+ "top": (winh + scrollTop - myh) / 3
+ }).show();
+
+ //初始化选择颜色插件
+ $("#luckysheet-imageCtrl-colorSelect-dialog").find(".colorshowbox").spectrum({
+ showPalette: true,
+ showPaletteOnly: true,
+ preferredFormat: "hex",
+ clickoutFiresChange: false,
+ showInitial: true,
+ showInput: true,
+ flat: true,
+ hideAfterPaletteSelect: true,
+ showSelectionPalette: true,
+ showButtons: false,//隐藏选择取消按钮
+ maxPaletteSize: 8,
+ maxSelectionSize: 8,
+ color: currenColor,
+ cancelText: locale_button.cancel,
+ chooseText: locale_toolbar.confirmColor,
+ togglePaletteMoreText: locale_toolbar.customColor,
+ togglePaletteLessText: locale_toolbar.collapse,
+ togglePaletteOnly: true,
+ clearText: locale_toolbar.clearText,
+ noColorSelectedText: locale_toolbar.noColorSelectedText,
+ localStorageKey: "spectrum.textcolor" + server.gridKey,
+ palette: [
+ ["#000", "#444", "#666", "#999", "#ccc", "#eee", "#f3f3f3", "#fff"],
+ ["#f00", "#f90", "#ff0", "#0f0", "#0ff", "#00f", "#90f", "#f0f"],
+ ["#f4cccc", "#fce5cd", "#fff2cc", "#d9ead3", "#d0e0e3", "#cfe2f3", "#d9d2e9", "#ead1dc"],
+ ["#ea9999", "#f9cb9c", "#ffe599", "#b6d7a8", "#a2c4c9", "#9fc5e8", "#b4a7d6", "#d5a6bd"],
+ ["#e06666", "#f6b26b", "#ffd966", "#93c47d", "#76a5af", "#6fa8dc", "#8e7cc3", "#c27ba0"],
+ ["#c00", "#e69138", "#f1c232", "#6aa84f", "#45818e", "#3d85c6", "#674ea7", "#a64d79"],
+ ["#900", "#b45f06", "#bf9000", "#38761d", "#134f5c", "#0b5394", "#351c75", "#741b47"],
+ ["#600", "#783f04", "#7f6000", "#274e13", "#0c343d", "#073763", "#20124d", "#4c1130"]
+ ],
+ move: function(color){
+ if (color != null) {
+ color = color.toHexString();
+ }
+ else {
+ color = "#000";
+ }
+
+ $("#luckysheet-imageCtrl-colorSelect-dialog .currenColor span").css("background-color", color).attr("title", color);
+ }
+ });
+ },
init: function() {
let _this = this;
+ //关闭
+ $("#luckysheet-modal-dialog-slider-imageCtrl .luckysheet-model-close-btn").click(function () {
+ $("#luckysheet-modal-dialog-slider-imageCtrl").hide();
+ luckysheetsizeauto();
+ });
+
+ //常规
+ $("#luckysheet-modal-dialog-slider-imageCtrl").off("change.radio").on("change.radio", ".radio-item input[type=radio][name=imgItemType]", function() {
+ _this.configChange("type", this.value);
+ })
+
+ //固定位置
+ $("#luckysheet-modal-dialog-slider-imageCtrl").off("change.checkbox").on("change.checkbox", ".slider-box-checkbox input[type=checkbox]", function() {
+ _this.configChange("fixedPos", this.checked);
+ })
+
+ //边框宽度
+ $("#luckysheet-modal-dialog-slider-imageCtrl").off("change.borderWidth").on("change.borderWidth", "#imgItemBorderWidth", function() {
+ _this.configChange("border-width", this.valueAsNumber);
+ })
+
+ //边框半径
+ $("#luckysheet-modal-dialog-slider-imageCtrl").off("change.borderRadius").on("change.borderRadius", "#imgItemBorderRadius", function() {
+ _this.configChange("border-radius", this.valueAsNumber);
+ })
+
+ //边框样式
+ $("#luckysheet-modal-dialog-slider-imageCtrl").off("change.borderStyle").on("change.borderStyle", "#imgItemBorderStyle", function() {
+ _this.configChange("border-radius", this.value);
+ })
+
+ //边框颜色 选择
+ $("#luckysheet-modal-dialog-slider-imageCtrl").off("click.color").on("click.color", "#imgItemBorderColor", function() {
+ let currenColor = $(this).find("span").attr("title");
+ _this.colorSelectDialog(currenColor);
+ })
+
+ //边框选择颜色 确定
+ $(document).off("click.selectColorConfirm").on("click.selectColorConfirm", "#luckysheet-imageCtrl-colorSelect-dialog-confirm", function(){
+ let $parent = $(this).parents("#luckysheet-imageCtrl-colorSelect-dialog");
+ $("#luckysheet-modal-dialog-mask").hide();
+ $parent.hide();
+
+ let currenColor = $parent.find(".currenColor span").attr("title");
+ $("#luckysheet-modal-dialog-slider-imageCtrl #imgItemBorderColor span").css("background-color", currenColor).attr("title", currenColor);
+
+ _this.configChange("border-color", currenColor);
+ });
+
//image active
$("#luckysheet-image-showBoxs").off("mousedown.active").on("mousedown.active", ".luckysheet-modal-dialog-image", function(e) {
$(this).hide();
@@ -73,24 +335,20 @@ const imageCtrl = {
_this.currentImgId = id;
let item = _this.images[id];
+ let imgItemParam = _this.getImgItemParam(item);
- let width = item.default.width,
- height = item.default.height,
- left = item.default.left,
- top = item.default.top;
-
- if(item.crop.width != width || item.crop.height != height){
- width = item.crop.width;
- height = item.crop.height;
- left = left + item.crop.offsetLeft;
- top = top + item.crop.offsetTop;
- }
+ let width = imgItemParam.width;
+ let height = imgItemParam.height;
+ let left = imgItemParam.left;
+ let top = imgItemParam.top;
+ let position = imgItemParam.position;
$("#luckysheet-modal-dialog-activeImage").show().css({
"width": width,
"height": height,
"left": left,
- "top": top
+ "top": top,
+ "position": position
});
$("#luckysheet-modal-dialog-activeImage .luckysheet-modal-dialog-content").css({
@@ -99,29 +357,38 @@ const imageCtrl = {
"background-position": -item.crop.offsetLeft + "px " + -item.crop.offsetTop + "px"
})
+ $("#luckysheet-modal-dialog-activeImage .luckysheet-modal-dialog-border").css({
+ "border-width": item.border.width,
+ "border-style": item.border.style,
+ "border-color": item.border.color,
+ "border-radius": item.border.radius,
+ "left": -item.border.width,
+ "right": -item.border.width,
+ "top": -item.border.width,
+ "bottom": -item.border.width,
+ })
+
+ _this.sliderHtmlShow();
+
e.stopPropagation();
})
//image move
$("#luckysheet-modal-dialog-activeImage").off("mousedown.move").on("mousedown.move", ".luckysheet-modal-dialog-content", function(e) {
+ if(!$("#luckysheet-modal-dialog-slider-imageCtrl").is(":visible")){
+ _this.sliderHtmlShow();
+ }
+
_this.move = true;
_this.currentWinW = $("#luckysheet-cell-main")[0].scrollWidth;
_this.currentWinH = $("#luckysheet-cell-main")[0].scrollHeight;
-
- let scrollTop = $("#luckysheet-cell-main").scrollTop(),
- scrollLeft = $("#luckysheet-cell-main").scrollLeft();
let offset = $("#luckysheet-modal-dialog-activeImage").offset();
- let position = $("#luckysheet-modal-dialog-activeImage").position();
_this.moveXY = [
e.pageX - offset.left,
e.pageY - offset.top,
- position.left,
- position.top,
- scrollLeft,
- scrollTop
];
setluckysheet_scroll_status(true);
@@ -162,54 +429,168 @@ const imageCtrl = {
e.stopPropagation();
})
- //image crop
- $("#luckysheet-modal-dialog-activeImage").off("mousedown.crop").on("mousedown.crop", ".luckysheet-modal-controll-crop", function(e) {
- $("#luckysheet-modal-dialog-activeImage").hide();
+ //image croppingEnter
+ $("#luckysheet-modal-dialog-activeImage").off("mousedown.croppingEnter").on("mousedown.croppingEnter", ".luckysheet-modal-controll-crop", function(e) {
+ _this.croppingEnter();
+ e.stopPropagation();
+ })
- let item = _this.images[_this.currentImgId];
+ //image croppingExit
+ $("#luckysheet-modal-dialog-cropping").off("mousedown.croppingExit").on("mousedown.croppingExit", ".luckysheet-modal-controll-crop", function(e) {
+ _this.croppingExit();
+ e.stopPropagation();
+ })
- let width = item.default.width,
- height = item.default.height,
- left = item.default.left,
- top = item.default.top;
+ //image crop change
+ $("#luckysheet-modal-dialog-cropping").off("mousedown.cropChange").on("mousedown.cropChange", ".resize-item", function(e) {
+ _this.cropChange = $(this).data("type");
- if(item.crop.width != width || item.crop.height != height){
- width = item.crop.width;
- height = item.crop.height;
- left = left + item.crop.offsetLeft;
- top = top + item.crop.offsetTop;
- }
-
- $("#luckysheet-modal-dialog-cropping").show().css({
- "width": width,
- "height": height,
- "left": left,
- "top": top
- });
-
- $("#luckysheet-modal-dialog-cropping .cropping-mask").css({
- "width": item.default.width,
- "height": item.default.height,
- "background-image": "url(" + item.src + ")",
- "left": -item.crop.offsetLeft,
- "top": -item.crop.offsetTop
- })
+ let scrollTop = $("#luckysheet-cell-main").scrollTop(),
+ scrollLeft = $("#luckysheet-cell-main").scrollLeft();
+ let mouse = mouseposition(e.pageX, e.pageY);
+ let x = mouse[0] + scrollLeft;
+ let y = mouse[1] + scrollTop;
- $("#luckysheet-modal-dialog-cropping .cropping-content").css({
- "background-image": "url(" + item.src + ")",
- "background-size": item.default.width + "px " + item.default.height + "px",
- "background-position": -item.crop.offsetLeft + "px " + -item.crop.offsetTop + "px"
- })
+ _this.cropChangeXY = [
+ x,
+ y
+ ];
+ setluckysheet_scroll_status(true);
+
e.stopPropagation();
})
//image delete
- $("#luckysheet-modal-dialog-activeImage").off("mousedown.delete").on("mousedown.delete", ".luckysheet-modal-controll-del", function(e) {
+ $("#luckysheet-image-showBoxs").off("mousedown.delete").on("mousedown.delete", ".luckysheet-modal-controll-del", function(e) {
_this.removeImgItem();
+ e.stopPropagation();
})
},
+ configChange: function(type, value){
+ let _this = this;
+
+ let imgItem = _this.images[_this.currentImgId];
+
+ switch(type){
+ case "type":
+ imgItem.type = value;
+ break;
+ case "fixedPos":
+ imgItem.isFixedPos = value;
+
+ let imgItemParam = _this.getImgItemParam(imgItem);
+ let width = imgItemParam.width;
+ let height = imgItemParam.height;
+ let left = imgItemParam.left;
+ let top = imgItemParam.top;
+ let position = imgItemParam.position;
+
+ $("#luckysheet-modal-dialog-activeImage").show().css({
+ "width": width,
+ "height": height,
+ "left": left,
+ "top": top,
+ "position": position
+ });
+ break;
+ case "border-width":
+ imgItem.border.width = value;
+ $("#luckysheet-modal-dialog-activeImage .luckysheet-modal-dialog-border").css({
+ "border-width": value,
+ "left": -value,
+ "right": -value,
+ "top": -value,
+ "bottom": -value
+ });
+ break;
+ case "border-radius":
+ imgItem.border.radius = value;
+ $("#luckysheet-modal-dialog-activeImage .luckysheet-modal-dialog-border").css("border-radius", value);
+ break;
+ case "border-style":
+ imgItem.border.style = value;
+ $("#luckysheet-modal-dialog-activeImage .luckysheet-modal-dialog-border").css("border-style", value);
+ break;
+ case "border-color":
+ imgItem.border.color = value;
+ $("#luckysheet-modal-dialog-activeImage .luckysheet-modal-dialog-border").css("border-color", value);
+ break;
+ }
+
+ _this.ref();
+ },
+ getImgItemParam(imgItem){
+ let isFixedPos = imgItem.isFixedPos;
+
+ let width = imgItem.default.width,
+ height = imgItem.default.height,
+ left = imgItem.default.left,
+ top = imgItem.default.top;
+
+ if(imgItem.crop.width != width || imgItem.crop.height != height){
+ width = imgItem.crop.width;
+ height = imgItem.crop.height;
+ left += imgItem.crop.offsetLeft;
+ top += imgItem.crop.offsetTop;
+ }
+
+ let position = 'absolute';
+ if(isFixedPos){
+ position = 'fixed';
+ left = imgItem.fixedLeft + imgItem.crop.offsetLeft;
+ top = imgItem.fixedTop + imgItem.crop.offsetTop;
+ }
+
+ return {
+ width: width,
+ height: height,
+ left: left,
+ top: top,
+ position: position
+ }
+ },
+ cancelActiveImgItem: function(){
+ let _this = this;
+
+ $("#luckysheet-modal-dialog-activeImage").hide();
+ $("#luckysheet-modal-dialog-cropping").hide();
+ $("#luckysheet-modal-dialog-slider-imageCtrl").hide();
+
+ let imgItem = _this.images[_this.currentImgId];
+ let imgItemParam = _this.getImgItemParam(imgItem);
+
+ let width = imgItemParam.width;
+ let height = imgItemParam.height;
+ let left = imgItemParam.left;
+ let top = imgItemParam.top;
+ let position = imgItemParam.position;
+
+ $("#" + _this.currentImgId).show().css({
+ "width": width,
+ "height": height,
+ "left": left,
+ "top": top,
+ "position": position
+ });
+ $("#" + _this.currentImgId + " img").css({
+ "width": imgItem.default.width,
+ "height": imgItem.default.height,
+ "left": -imgItem.crop.offsetLeft,
+ "top": -imgItem.crop.offsetTop
+ });
+ $("#" + _this.currentImgId + " .luckysheet-modal-dialog-border").css({
+ "border-width": imgItem.border.width,
+ "border-style": imgItem.border.style,
+ "border-color": imgItem.border.color,
+ "border-radius": imgItem.border.radius,
+ "left": -imgItem.border.width,
+ "right": -imgItem.border.width,
+ "top": -imgItem.border.width,
+ "bottom": -imgItem.border.width,
+ })
+ },
addImgItem: function(img) {
let _this = this;
@@ -240,12 +621,19 @@ const imageCtrl = {
imgItem.crop.width = width;
imgItem.crop.height = height;
+ let scrollTop = $("#luckysheet-cell-main").scrollTop(),
+ scrollLeft = $("#luckysheet-cell-main").scrollLeft();
+
+ imgItem.fixedLeft = img.left - scrollLeft + Store.rowHeaderWidth;
+ imgItem.fixedTop = img.top - scrollTop + Store.infobarHeight + Store.toolbarHeight + Store.calculatebarHeight + Store.columeHeaderHeight;
+
let id = _this.generateRandomId();
let modelHtml = _this.modelHtml(id, imgItem);
- $("#luckysheet-image-showBoxs").append(modelHtml);
+ $("#luckysheet-image-showBoxs .img-list").append(modelHtml);
_this.images[id] = imgItem;
+ _this.ref();
_this.init();
},
@@ -254,29 +642,229 @@ const imageCtrl = {
_this.move = false;
- let position = $("#luckysheet-modal-dialog-activeImage").position();
- _this.images[_this.currentImgId].left = position.left;
- _this.images[_this.currentImgId].top = position.top;
+ let obj = $("#luckysheet-modal-dialog-activeImage")[0];
+ let item = _this.images[_this.currentImgId];
+
+ if(item.isFixedPos){
+ item.fixedLeft = obj.offsetLeft - item.crop.offsetLeft;
+ item.fixedTop = obj.offsetTop - item.crop.offsetTop;
+ }
+ else{
+ item.default.left = obj.offsetLeft - item.crop.offsetLeft;
+ item.default.top = obj.offsetTop - item.crop.offsetTop;
+ }
+
+ _this.ref();
},
resizeImgItem: function() {
let _this = this;
_this.resize = null;
- let position = $("#luckysheet-modal-dialog-activeImage").position();
- let width = $("#luckysheet-modal-dialog-activeImage").outerWidth();
- let height = $("#luckysheet-modal-dialog-activeImage").outerHeight();
+ let obj = $("#luckysheet-modal-dialog-activeImage")[0];
+
+ let item = _this.images[_this.currentImgId];
+ let scaleX = obj.clientWidth / item.crop.width;
+ let scaleY = obj.clientHeight / item.crop.height;
+
+ item.default.width = Math.round(item.default.width * scaleX);
+ item.default.height = Math.round(item.default.height * scaleY);
+
+ item.crop.width = Math.round(item.crop.width * scaleX);
+ item.crop.height = Math.round(item.crop.height * scaleY);
+ item.crop.offsetLeft = Math.round(item.crop.offsetLeft * scaleX);
+ item.crop.offsetTop = Math.round(item.crop.offsetTop * scaleY);
+
+ if(item.isFixedPos){
+ item.fixedLeft = obj.offsetLeft;
+ item.fixedTop = obj.offsetTop;
+ }
+ else{
+ item.default.left = obj.offsetLeft - item.crop.offsetLeft;
+ item.default.top = obj.offsetTop - item.crop.offsetTop;
+ }
+
+ _this.ref();
+ },
+ croppingEnter: function() {
+ let _this = this;
+ _this.cropping = true;
+
+ $("#luckysheet-modal-dialog-activeImage").hide();
+ $("#luckysheet-modal-dialog-slider-imageCtrl").hide();
+
+ let item = _this.images[_this.currentImgId];
+ let imgItemParam = _this.getImgItemParam(item);
+
+ let width = imgItemParam.width;
+ let height = imgItemParam.height;
+ let left = imgItemParam.left;
+ let top = imgItemParam.top;
+ let position = imgItemParam.position;
+
+ $("#luckysheet-modal-dialog-cropping").show().css({
+ "width": width,
+ "height": height,
+ "left": left,
+ "top": top,
+ "position": position
+ });
+
+ $("#luckysheet-modal-dialog-cropping .cropping-mask").css({
+ "width": item.default.width,
+ "height": item.default.height,
+ "background-image": "url(" + item.src + ")",
+ "left": -item.crop.offsetLeft,
+ "top": -item.crop.offsetTop
+ })
+
+ $("#luckysheet-modal-dialog-cropping .cropping-content").css({
+ "background-image": "url(" + item.src + ")",
+ "background-size": item.default.width + "px " + item.default.height + "px",
+ "background-position": -item.crop.offsetLeft + "px " + -item.crop.offsetTop + "px"
+ })
- _this.images[_this.currentImgId].width = width;
- _this.images[_this.currentImgId].height = height;
- _this.images[_this.currentImgId].left = position.left;
- _this.images[_this.currentImgId].top = position.top;
+ $("#luckysheet-modal-dialog-cropping .luckysheet-modal-dialog-border").css({
+ "border-width": item.border.width,
+ "border-style": item.border.style,
+ "border-color": item.border.color,
+ "border-radius": item.border.radius,
+ "left": -item.border.width,
+ "right": -item.border.width,
+ "top": -item.border.width,
+ "bottom": -item.border.width,
+ })
+ },
+ croppingExit: function() {
+ let _this = this;
+ _this.cropping = false;
+
+ $("#luckysheet-modal-dialog-cropping").hide();
+
+ let item = _this.images[_this.currentImgId];
+ let imgItemParam = _this.getImgItemParam(item);
+
+ let width = imgItemParam.width;
+ let height = imgItemParam.height;
+ let left = imgItemParam.left;
+ let top = imgItemParam.top;
+ let position = imgItemParam.position;
+
+ $("#luckysheet-modal-dialog-activeImage").show().css({
+ "width": width,
+ "height": height,
+ "left": left,
+ "top": top,
+ "position": position
+ });
+
+ $("#luckysheet-modal-dialog-activeImage .luckysheet-modal-dialog-content").css({
+ "background-image": "url(" + item.src + ")",
+ "background-size": item.default.width + "px " + item.default.height + "px",
+ "background-position": -item.crop.offsetLeft + "px " + -item.crop.offsetTop + "px"
+ })
+ },
+ cropChangeImgItem: function() {
+ let _this = this;
+
+ _this.cropChange = null;
+
+ let item = _this.images[_this.currentImgId];
+ item.crop.width = _this.cropChangeObj.width;
+ item.crop.height = _this.cropChangeObj.height;
+ item.crop.offsetLeft = _this.cropChangeObj.offsetLeft;
+ item.crop.offsetTop = _this.cropChangeObj.offsetTop;
+
+ _this.ref();
},
removeImgItem: function() {
let _this = this;
+
+ $("#luckysheet-modal-dialog-activeImage").hide();
+ $("#luckysheet-modal-dialog-cropping").hide();
+ $("#luckysheet-modal-dialog-slider-imageCtrl").hide();
+ $("#" + _this.currentImgId).remove();
delete _this.images[_this.currentImgId];
+ _this.currentImgId = null;
+
+ _this.ref();
+ },
+ allImagesShow: function() {
+ let _this = this;
+
$("#luckysheet-modal-dialog-activeImage").hide();
+ $("#luckysheet-modal-dialog-cropping").hide();
+ $("#luckysheet-modal-dialog-slider-imageCtrl").hide();
+ $("#luckysheet-image-showBoxs .img-list").empty();
+
+ if(_this.images == null){
+ return;
+ }
+
+ for(let imgId in _this.images){
+ let imgItem = _this.images[imgId];
+ let modelHtml = _this.modelHtml(imgId, imgItem);
+ $("#luckysheet-image-showBoxs .img-list").append(modelHtml);
+ }
+ },
+ moveChangeSize: function(rc, index, changeSize) {
+ let _this = this;
+ let images = $.extend(true, {}, _this.images);
+
+ if(rc == "row"){
+ let row = Store.visibledatarow[index],
+ row_pre = index - 1 == -1 ? 0 : Store.visibledatarow[index - 1];
+
+
+ }
+ else if(rc == "column"){
+ let col = Store.visibledatacolumn[index],
+ col_pre = index - 1 == -1 ? 0 : Store.visibledatacolumn[index - 1];
+
+ for(let imgId in images){
+ let imgItem = images[imgId];
+ let imgItemParam = _this.getImgItemParam(imgItem);
+ let type = imgItem.type;
+
+ if(type == "1"){
+ if(imgItemParam.left >= col){
+ imgItem.default.left = imgItemParam.left + changeSize - item.crop.offsetLeft;
+ }
+ else{
+ if(imgItemParam.left + imgItemParam.width > col){
+ let scaleX = obj.clientWidth / item.crop.width;
+ }
+ else{
+
+ }
+ }
+ }
+ else if(type == "2"){
+
+ }
+ }
+ }
+ },
+ ref: function() {
+ let _this = this;
+
+ let file = Store.luckysheetfile[getSheetIndex(Store.currentSheetIndex)];
+ let images = _this.images;
+
+ if (Store.clearjfundo) {
+ Store.jfundo = [];
+
+ Store.jfredo.push({
+ "type": "imageCtrl",
+ "sheetIndex": Store.currentSheetIndex,
+ "images": file.images == null ? null : $.extend(true, {}, file.images),
+ "curImages": images
+ });
+ }
+
+ file.images = $.extend(true, {}, images);
+ server.saveParam("all", Store.currentSheetIndex, file.images, { "k": "images" });
},
}
diff --git a/src/controllers/rowColumnOperation.js b/src/controllers/rowColumnOperation.js
index f36900e..f8b039c 100644
--- a/src/controllers/rowColumnOperation.js
+++ b/src/controllers/rowColumnOperation.js
@@ -1,6 +1,7 @@
import pivotTable from './pivotTable';
import luckysheetPostil from './postil';
+import imageCtrl from './imageCtrl';
import menuButton from './menuButton';
import server from './server';
import { selectHightlightShow, luckysheet_count_show,selectHelpboxFill } from './select';
@@ -42,6 +43,11 @@ export function rowColumnOperationInitial(){
//有批注在编辑时
luckysheetPostil.removeActivePs();
+ //图片 active/cropping
+ if($("#luckysheet-modal-dialog-activeImage").is(":visible") || $("#luckysheet-modal-dialog-cropping").is(":visible")){
+ imageCtrl.cancelActiveImgItem();
+ }
+
let mouse = mouseposition(event.pageX, event.pageY);
let y = mouse[1] + $("#luckysheet-rows-h").scrollTop();
@@ -423,6 +429,11 @@ export function rowColumnOperationInitial(){
//有批注在编辑时
luckysheetPostil.removeActivePs();
+ //图片 active/cropping
+ if($("#luckysheet-modal-dialog-activeImage").is(":visible") || $("#luckysheet-modal-dialog-cropping").is(":visible")){
+ imageCtrl.cancelActiveImgItem();
+ }
+
let mouse = mouseposition(event.pageX, event.pageY);
let x = mouse[0] + $(this).scrollLeft();
@@ -810,6 +821,11 @@ export function rowColumnOperationInitial(){
$("#luckysheet-rows-change-size").mousedown(function (event) {
//有批注在编辑时
luckysheetPostil.removeActivePs();
+
+ //图片 active/cropping
+ if($("#luckysheet-modal-dialog-activeImage").is(":visible") || $("#luckysheet-modal-dialog-cropping").is(":visible")){
+ imageCtrl.cancelActiveImgItem();
+ }
$("#luckysheet-input-box").hide();
$("#luckysheet-rows-change-size").css({ "opacity": 1 });
@@ -850,6 +866,11 @@ export function rowColumnOperationInitial(){
//有批注在编辑时
luckysheetPostil.removeActivePs();
+ //图片 active/cropping
+ if($("#luckysheet-modal-dialog-activeImage").is(":visible") || $("#luckysheet-modal-dialog-cropping").is(":visible")){
+ imageCtrl.cancelActiveImgItem();
+ }
+
$("#luckysheet-input-box").hide();
$("#luckysheet-cols-change-size").css({ "opacity": 1 });
diff --git a/src/controllers/sheetmanage.js b/src/controllers/sheetmanage.js
index 995a77a..15f6b08 100644
--- a/src/controllers/sheetmanage.js
+++ b/src/controllers/sheetmanage.js
@@ -17,6 +17,7 @@ import luckysheetConfigsetting from './luckysheetConfigsetting';
import pivotTable from './pivotTable';
import luckysheetsizeauto from './resize';
import luckysheetPostil from './postil';
+import imageCtrl from './imageCtrl';
import luckysheetFreezen from './freezen';
import { createFilterOptions, labelFilterOptionState } from './filter';
import { selectHightlightShow, selectionCopyShow } from './select';
@@ -861,7 +862,12 @@ const sheetmanage = {
formula.execFunctionGroupData = null;
window.luckysheet_getcelldata_cache = null;
+ //批注
luckysheetPostil.buildAllPs(Store.flowdata);
+
+ //图片
+ imageCtrl.images = file.images;
+ imageCtrl.allImagesShow();
this.sheetParamRestore(file, Store.flowdata);
diff --git a/src/css/luckysheet-core.css b/src/css/luckysheet-core.css
index 777039e..bc9d4f2 100644
--- a/src/css/luckysheet-core.css
+++ b/src/css/luckysheet-core.css
@@ -2922,7 +2922,7 @@ fieldset[disabled] a.btn {
display: none;
left: 0px;
top: 0px;
- z-index: 1004;
+ z-index: 1010;
}
@@ -6188,7 +6188,7 @@ fieldset[disabled] a.btn {
display: none;
left: 0px;
top: 0px;
- z-index: 1004;
+ z-index: 1010;
}
@@ -6454,6 +6454,7 @@ fieldset[disabled] a.btn {
left: 0;
bottom: 0;
right: 0;
+ pointer-events: all;
}
#luckysheet-modal-dialog-cropping .resize-item{
width: 0;
@@ -6614,4 +6615,77 @@ fieldset[disabled] a.btn {
border-left: 2px solid #fff;
border-right: 2px solid #fff;
border-top: 2px solid #fff;
+}
+#luckysheet-modal-dialog-slider-imageCtrl .luckysheet-modal-dialog-slider-content{
+ background-color: #fff;
+}
+#luckysheet-modal-dialog-slider-imageCtrl .slider-box{
+ border-bottom: 1px solid #E1E4E8;
+}
+#luckysheet-modal-dialog-slider-imageCtrl .slider-box .slider-box-title{
+ padding: 10px 20px;
+ font-weight: 600;
+}
+#luckysheet-modal-dialog-slider-imageCtrl .slider-box .slider-box-radios{
+ padding: 10px 30px;
+}
+#luckysheet-modal-dialog-slider-imageCtrl .slider-box .radio-item{
+ margin-bottom: 10px;
+}
+#luckysheet-modal-dialog-slider-imageCtrl .slider-box .radio-item:last-child{
+ margin-bottom: 0;
+}
+#luckysheet-modal-dialog-slider-imageCtrl .slider-box .radio-item input{
+ vertical-align: sub;
+}
+#luckysheet-modal-dialog-slider-imageCtrl .slider-box .slider-box-checkbox{
+ padding: 10px 30px;
+ border-top: 1px solid #E1E4E8;
+}
+#luckysheet-modal-dialog-slider-imageCtrl .slider-box .slider-box-checkbox input{
+ vertical-align: middle;
+}
+#luckysheet-modal-dialog-slider-imageCtrl .slider-box .slider-box-borderConfig{
+ padding: 10px 30px;
+}
+#luckysheet-modal-dialog-slider-imageCtrl .slider-box .border-item{
+ margin-bottom: 10px;
+}
+#luckysheet-modal-dialog-slider-imageCtrl .slider-box .border-item:last-child{
+ margin-bottom: 0;
+}
+#luckysheet-modal-dialog-slider-imageCtrl .slider-box .border-item label{
+ display: inline-block;
+ width: 40px;
+}
+#luckysheet-modal-dialog-slider-imageCtrl .slider-box .border-item input{
+ width: 130px;
+ padding: 5px;
+}
+#luckysheet-modal-dialog-slider-imageCtrl .slider-box .border-item .imgItemBorderColor{
+ display: inline-block;
+ width: 20px;
+ height: 20px;
+ padding: 2px;
+ border: 1px solid #E1E4E8;
+ vertical-align: middle;
+ cursor: pointer;
+}
+#luckysheet-modal-dialog-slider-imageCtrl .slider-box .border-item .imgItemBorderColor span{
+ display: block;
+ width: 100%;
+ height: 100%;
+}
+#luckysheet-imageCtrl-colorSelect-dialog .currenColor{
+ font-size: 12px;
+ margin-bottom: 5px;
+}
+#luckysheet-imageCtrl-colorSelect-dialog .currenColor span{
+ display: inline-block;
+ width: 16px;
+ height: 16px;
+ border: solid 1px #d0d0d0;
+ margin-left: 5px;
+ margin-bottom: -5px;
+ cursor: pointer;
}
\ No newline at end of file
diff --git a/src/locale/en.js b/src/locale/en.js
index 6897422..fb0dd08 100644
--- a/src/locale/en.js
+++ b/src/locale/en.js
@@ -45,6 +45,7 @@ export default {
chart: 'Chart',
screenshot: 'Screenshot',
splitColumn: 'Split text',
+ insertImage: 'Insert image',
clearText:"Clear color",
noColorSelectedText:"No color is selected",
@@ -582,6 +583,24 @@ export default {
tipNoMulti:"Cannot perform this operation on multiple selection areas, please select a single area and try again",
tipNoMultiColumn:"Only one column of data can be converted at a time. The selected area can have multiple rows but not multiple columns. Please try again after selecting a single column range",
},
+ imageText:{
+ imageSetting: 'Image setting',
+ close: 'Close',
+ conventional: 'Conventional',
+ moveCell1: 'Move and resize cells',
+ moveCell2: 'Move and do not resize the cell',
+ moveCell3: 'Do not move and resize the cell',
+ fixedPos: 'Fixed position',
+ border: 'Border',
+ width: 'Width',
+ radius: 'Radius',
+ style: 'Style',
+ solid: 'Solid',
+ dashed: 'Dashed',
+ dotted: 'Dotted',
+ double: 'Double',
+ color: 'Color',
+ },
punctuation:{
"tab":"Tab",
"semicolon":"semicolon",
diff --git a/src/locale/zh.js b/src/locale/zh.js
index 6efde0d..fd18cb7 100644
--- a/src/locale/zh.js
+++ b/src/locale/zh.js
@@ -45,6 +45,7 @@ export default {
chart: '图表',
screenshot: '截图',
splitColumn: '分列',
+ insertImage: '插入图片',
clearText:"清除颜色选择",
noColorSelectedText:"没有颜色被选择",
@@ -598,6 +599,24 @@ export default {
tipNoMulti:"不能对多重选择区域执行此操作,请选择单个区域,然后再试",
tipNoMultiColumn:"一次只能转换一列数据,选定区域可以有多行,但不能有多列,请在选定单列区域以后再试",
},
+ imageText:{
+ imageSetting: '图片设置',
+ close: '关闭',
+ conventional: '常规',
+ moveCell1: '移动并调整单元格大小',
+ moveCell2: '移动并且不调整单元格的大小',
+ moveCell3: '不要移动单元格并调整其大小',
+ fixedPos: '固定位置',
+ border: '边框',
+ width: '宽度',
+ radius: '半径',
+ style: '样式',
+ solid: '实线',
+ dashed: '虚线',
+ dotted: '点状',
+ double: '双线',
+ color: '颜色',
+ },
punctuation:{
"tab":"Tab 键",
"semicolon":"分号",