Commit c3f3da85 authored by Julia Radzhabova's avatar Julia Radzhabova

Fix Bug 34088, Bug 34064.

parent d23c3951
......@@ -54,7 +54,8 @@ define([
var _stack = [],
_chartObject = undefined,
_shapeObject = undefined,
_metricText = Common.Utils.Metric.getCurrentMetricName();
_metricText = Common.Utils.Metric.getCurrentMetricName(),
_borderColor = 'transparent';
var wrapTypesTransform = (function() {
var map = [
......@@ -80,7 +81,7 @@ define([
return obj.ui === type;
})[0];
return record ? record.sdk : 0;
},
}
}
})();
......@@ -260,13 +261,18 @@ define([
paletteFillColor && paletteFillColor.select(color);
// Init border color
var stroke = shapeProperties.get_stroke(),
strokeType = stroke.get_type();
me._initBorderColorView();
},
color = 'transparent';
_initBorderColorView: function () {
var me = this,
paletteBorderColor = me.getView('EditChart').paletteBorderColor,
stroke = _shapeObject.get_ShapeProperties().get_stroke();
var color = 'transparent';
if (stroke && strokeType == Asc.c_oAscStrokeType.STROKE_COLOR) {
sdkColor = stroke.get_color();
if (stroke && stroke.get_type() == Asc.c_oAscStrokeType.STROKE_COLOR) {
var sdkColor = stroke.get_color();
if (sdkColor) {
if (sdkColor.get_type() == Asc.c_oAscColor.COLOR_TYPE_SCHEME) {
......@@ -277,6 +283,7 @@ define([
}
}
}
_borderColor = color;
paletteBorderColor && paletteBorderColor.select(color);
$('#edit-chart-bordercolor .color-preview').css('background-color', ('transparent' == color) ? color : ('#' + (_.isObject(color) ? color.color : color)))
......@@ -440,29 +447,20 @@ define([
var me = this,
$target = $(e.currentTarget),
value = $target.val(),
currentShape = _shapeObject.get_ShapeProperties(),
image = new Asc.asc_CImgProperty(),
shape = new Asc.asc_CShapeProperty(),
stroke = new Asc.asc_CStroke(),
currentColor = Common.Utils.ThemeColor.getRgbColor('000000');
stroke = new Asc.asc_CStroke();
value = borderSizeTransform.sizeByIndex(parseInt(value));
var currentStroke = currentShape.get_stroke();
if (currentStroke) {
var currentStrokeType = currentStroke.get_type();
if (currentStrokeType == Asc.c_oAscStrokeType.STROKE_COLOR) {
currentColor = currentStroke.get_color();
}
}
if (value < 0.01) {
stroke.put_type(Asc.c_oAscStrokeType.STROKE_NONE);
} else {
stroke.put_type(Asc.c_oAscStrokeType.STROKE_COLOR);
stroke.put_color(currentColor);
if (_borderColor == 'transparent')
stroke.put_color(Common.Utils.ThemeColor.getRgbColor({color: '000000', effectId: 29}));
else
stroke.put_color(Common.Utils.ThemeColor.getRgbColor(Common.Utils.ThemeColor.colorValue2EffectId(_borderColor)));
stroke.put_width(value * 25.4 / 72.0);
}
......@@ -470,6 +468,7 @@ define([
image.put_ShapeProperties(shape);
me.api.ImgApply(image);
me._initBorderColorView(); // when select STROKE_NONE or change from STROKE_NONE to STROKE_COLOR
},
onBorderSizeChanging: function (e) {
......@@ -506,8 +505,9 @@ define([
currentShape = _shapeObject.get_ShapeProperties();
$('#edit-chart-bordercolor .color-preview').css('background-color', ('transparent' == color) ? color : ('#' + (_.isObject(color) ? color.color : color)));
_borderColor = color;
if (me.api && currentShape) {
if (me.api && currentShape && currentShape.get_stroke().get_type() == Asc.c_oAscStrokeType.STROKE_COLOR) {
var image = new Asc.asc_CImgProperty(),
shape = new Asc.asc_CShapeProperty(),
stroke = new Asc.asc_CStroke();
......
......@@ -53,7 +53,8 @@ define([
// Private
var _stack = [],
_shapeObject = undefined,
_metricText = Common.Utils.Metric.getCurrentMetricName();
_metricText = Common.Utils.Metric.getCurrentMetricName(),
_borderColor = 'transparent';
var wrapTypesTransform = (function() {
var map = [
......@@ -79,7 +80,7 @@ define([
return obj.ui === type;
})[0];
return record ? record.sdk : 0;
},
}
}
})();
......@@ -101,7 +102,7 @@ define([
}
});
return index
return index;
},
sizeByValue: function (value) {
......@@ -254,13 +255,18 @@ define([
paletteFillColor && paletteFillColor.select(color);
// Init border color
var stroke = shapeProperties.get_stroke(),
strokeType = stroke.get_type();
me._initBorderColorView();
},
color = 'transparent';
_initBorderColorView: function () {
var me = this,
paletteBorderColor = me.getView('EditShape').paletteBorderColor,
stroke = _shapeObject.get_ShapeProperties().get_stroke();
var color = 'transparent';
if (stroke && strokeType == Asc.c_oAscStrokeType.STROKE_COLOR) {
sdkColor = stroke.get_color();
if (stroke && stroke.get_type() == Asc.c_oAscStrokeType.STROKE_COLOR) {
var sdkColor = stroke.get_color();
if (sdkColor) {
if (sdkColor.get_type() == Asc.c_oAscColor.COLOR_TYPE_SCHEME) {
......@@ -271,6 +277,7 @@ define([
}
}
}
_borderColor = color;
paletteBorderColor && paletteBorderColor.select(color);
$('#edit-shape-bordercolor .color-preview').css('background-color', ('transparent' == color) ? color : ('#' + (_.isObject(color) ? color.color : color)))
......@@ -407,29 +414,20 @@ define([
var me = this,
$target = $(e.currentTarget),
value = $target.val(),
currentShape = _shapeObject.get_ShapeProperties(),
image = new Asc.asc_CImgProperty(),
shape = new Asc.asc_CShapeProperty(),
stroke = new Asc.asc_CStroke(),
currentColor = Common.Utils.ThemeColor.getRgbColor('000000');
stroke = new Asc.asc_CStroke();
value = borderSizeTransform.sizeByIndex(parseInt(value));
var currentStroke = currentShape.get_stroke();
if (currentStroke) {
var currentStrokeType = currentStroke.get_type();
if (currentStrokeType == Asc.c_oAscStrokeType.STROKE_COLOR) {
currentColor = currentStroke.get_color();
}
}
if (value < 0.01) {
stroke.put_type(Asc.c_oAscStrokeType.STROKE_NONE);
} else {
stroke.put_type(Asc.c_oAscStrokeType.STROKE_COLOR);
stroke.put_color(currentColor);
if (_borderColor == 'transparent')
stroke.put_color(Common.Utils.ThemeColor.getRgbColor({color: '000000', effectId: 29}));
else
stroke.put_color(Common.Utils.ThemeColor.getRgbColor(Common.Utils.ThemeColor.colorValue2EffectId(_borderColor)));
stroke.put_width(value * 25.4 / 72.0);
}
......@@ -437,6 +435,7 @@ define([
image.put_ShapeProperties(shape);
me.api.ImgApply(image);
me._initBorderColorView(); // when select STROKE_NONE or change from STROKE_NONE to STROKE_COLOR
},
onBorderSizeChanging: function (e) {
......@@ -494,8 +493,9 @@ define([
currentShape = _shapeObject.get_ShapeProperties();
$('#edit-shape-bordercolor .color-preview').css('background-color', ('transparent' == color) ? color : ('#' + (_.isObject(color) ? color.color : color)));
_borderColor = color;
if (me.api && currentShape) {
if (me.api && currentShape && currentShape.get_stroke().get_type() == Asc.c_oAscStrokeType.STROKE_COLOR) {
var image = new Asc.asc_CImgProperty(),
shape = new Asc.asc_CShapeProperty(),
stroke = new Asc.asc_CStroke();
......
......@@ -54,7 +54,8 @@ define([
var _stack = [],
_chartObject = undefined,
_shapeObject = undefined,
_metricText = Common.Utils.Metric.getCurrentMetricName();
_metricText = Common.Utils.Metric.getCurrentMetricName(),
_borderColor = 'transparent';
var borderSizeTransform = (function() {
var _sizes = [0, 0.5, 1, 1.5, 2.25, 3, 4.5, 6];
......@@ -66,14 +67,19 @@ define([
return _sizes[index];
},
sizeByValue: function (value) {
indexSizeByValue: function (value) {
var index = 0;
_.each(_sizes, function (size, idx) {
if (Math.abs(size - value) < 0.25) {
index = idx;
}
});
return _sizes[index];
return index
},
sizeByValue: function (value) {
return _sizes[this.indexSizeByValue(value)];
}
}
})();
......@@ -157,9 +163,10 @@ define([
$('.chart-types li[data-type=' + type + ']').addClass('active');
// Init style border size
var borderSize = shapeProperties.get_stroke().get_width() * 72.0 / 25.4;
$('#edit-chart-bordersize input').val([borderSizeTransform.sizeByIndex(borderSize)]);
$('#edit-chart-bordersize .item-after').text(borderSizeTransform.sizeByValue(borderSize) + ' ' + _metricText);
var borderSize = shapeProperties.get_stroke().get_width() * 72.0 / 25.4,
borderType = _shapeObject.get_stroke().get_type();
$('#edit-chart-bordersize input').val([(borderType == Asc.c_oAscStrokeType.STROKE_NONE) ? 0 : borderSizeTransform.indexSizeByValue(borderSize)]);
$('#edit-chart-bordersize .item-after').text(((borderType == Asc.c_oAscStrokeType.STROKE_NONE) ? 0 : borderSizeTransform.sizeByValue(borderSize)) + ' ' + _metricText);
paletteFillColor && paletteFillColor.on('select', _.bind(me.onFillColor, me));
paletteBorderColor && paletteBorderColor.on('select', _.bind(me.onBorderColor, me));
......@@ -188,13 +195,18 @@ define([
paletteFillColor && paletteFillColor.select(color);
// Init border color
var stroke = shapeProperties.get_stroke(),
strokeType = stroke.get_type();
me._initBorderColorView();
},
color = 'transparent';
_initBorderColorView: function () {
var me = this,
paletteBorderColor = me.getView('EditChart').paletteBorderColor,
stroke = _shapeObject.get_stroke();
var color = 'transparent';
if (stroke && strokeType == Asc.c_oAscStrokeType.STROKE_COLOR) {
sdkColor = stroke.get_color();
if (stroke && stroke.get_type() == Asc.c_oAscStrokeType.STROKE_COLOR) {
var sdkColor = stroke.get_color();
if (sdkColor) {
if (sdkColor.get_type() == Asc.c_oAscColor.COLOR_TYPE_SCHEME) {
......@@ -205,6 +217,7 @@ define([
}
}
}
_borderColor = color;
paletteBorderColor && paletteBorderColor.select(color);
$('#edit-chart-bordercolor .color-preview').css('background-color', ('transparent' == color) ? color : ('#' + (_.isObject(color) ? color.color : color)))
......@@ -292,33 +305,25 @@ define([
$target = $(e.currentTarget),
value = $target.val(),
shape = new Asc.asc_CShapeProperty(),
stroke = new Asc.asc_CStroke(),
currentColor = Common.Utils.ThemeColor.getRgbColor('000000');
stroke = new Asc.asc_CStroke();
value = borderSizeTransform.sizeByIndex(parseInt(value));
var currentStroke = _shapeObject.get_stroke();
if (currentStroke) {
var currentStrokeType = currentStroke.get_type();
if (currentStrokeType == Asc.c_oAscStrokeType.STROKE_COLOR) {
currentColor = currentStroke.get_color();
}
}
if (value < 0.01) {
stroke.put_type(Asc.c_oAscStrokeType.STROKE_NONE);
} else {
stroke.put_type(Asc.c_oAscStrokeType.STROKE_COLOR);
stroke.put_color(currentColor);
stroke.asc_putPrstDash(currentStroke.asc_getPrstDash());
if (_borderColor == 'transparent')
stroke.put_color(Common.Utils.ThemeColor.getRgbColor({color: '000000', effectId: 29}));
else
stroke.put_color(Common.Utils.ThemeColor.getRgbColor(Common.Utils.ThemeColor.colorValue2EffectId(_borderColor)));
stroke.put_width(value * 25.4 / 72.0);
}
shape.put_stroke(stroke);
me.api.ShapeApply(shape);
me._initBorderColorView(); // when select STROKE_NONE or change from STROKE_NONE to STROKE_COLOR
},
onBorderSizeChanging: function (e) {
......@@ -352,8 +357,9 @@ define([
var me = this;
$('#edit-chart-bordercolor .color-preview').css('background-color', ('transparent' == color) ? color : ('#' + (_.isObject(color) ? color.color : color)));
_borderColor = color;
if (me.api && _shapeObject) {
if (me.api && _shapeObject && _shapeObject.get_stroke().get_type() == Asc.c_oAscStrokeType.STROKE_COLOR) {
var shape = new Asc.asc_CShapeProperty(),
stroke = new Asc.asc_CStroke();
......
......@@ -53,7 +53,8 @@ define([
// Private
var _stack = [],
_shapeObject = undefined,
_metricText = Common.Utils.Metric.getCurrentMetricName();
_metricText = Common.Utils.Metric.getCurrentMetricName(),
_borderColor = 'transparent';
var borderSizeTransform = (function() {
var _sizes = [0, 0.5, 1, 1.5, 2.25, 3, 4.5, 6];
......@@ -151,8 +152,8 @@ define([
paletteBorderColor = me.getView('EditShape').paletteBorderColor;
// Init style border size
var borderSize = _shapeObject.get_stroke().get_width() * 72.0 / 25.4;
var borderType = _shapeObject.get_stroke().get_type();
var borderSize = _shapeObject.get_stroke().get_width() * 72.0 / 25.4,
borderType = _shapeObject.get_stroke().get_type();
$('#edit-shape-bordersize input').val([(borderType == Asc.c_oAscStrokeType.STROKE_NONE) ? 0 : borderSizeTransform.indexSizeByValue(borderSize)]);
$('#edit-shape-bordersize .item-after').text(((borderType == Asc.c_oAscStrokeType.STROKE_NONE) ? 0 : borderSizeTransform.sizeByValue(borderSize)) + ' ' + _metricText);
......@@ -187,13 +188,18 @@ define([
paletteFillColor && paletteFillColor.select(color);
// Init border color
var stroke = _shapeObject.get_stroke(),
strokeType = stroke.get_type();
me._initBorderColorView();
},
color = 'transparent';
_initBorderColorView: function () {
var me = this,
paletteBorderColor = me.getView('EditShape').paletteBorderColor,
stroke = _shapeObject.get_stroke();
if (stroke && strokeType == Asc.c_oAscStrokeType.STROKE_COLOR) {
sdkColor = stroke.get_color();
var color = 'transparent';
if (stroke && stroke.get_type() == Asc.c_oAscStrokeType.STROKE_COLOR) {
var sdkColor = stroke.get_color();
if (sdkColor) {
if (sdkColor.get_type() == Asc.c_oAscColor.COLOR_TYPE_SCHEME) {
......@@ -204,6 +210,7 @@ define([
}
}
}
_borderColor = color;
paletteBorderColor && paletteBorderColor.select(color);
$('#edit-shape-bordercolor .color-preview').css('background-color', ('transparent' == color) ? color : ('#' + (_.isObject(color) ? color.color : color)))
......@@ -272,33 +279,25 @@ define([
$target = $(e.currentTarget),
value = $target.val(),
shape = new Asc.asc_CShapeProperty(),
stroke = new Asc.asc_CStroke(),
currentColor = Common.Utils.ThemeColor.getRgbColor('000000');
stroke = new Asc.asc_CStroke();
value = borderSizeTransform.sizeByIndex(parseInt(value));
var currentStroke = _shapeObject.get_stroke();
if (currentStroke) {
var currentStrokeType = currentStroke.get_type();
if (currentStrokeType == Asc.c_oAscStrokeType.STROKE_COLOR) {
currentColor = currentStroke.get_color();
}
}
if (value < 0.01) {
stroke.put_type(Asc.c_oAscStrokeType.STROKE_NONE);
} else {
stroke.put_type(Asc.c_oAscStrokeType.STROKE_COLOR);
stroke.put_color(currentColor);
stroke.asc_putPrstDash(currentStroke.asc_getPrstDash());
if (_borderColor == 'transparent')
stroke.put_color(Common.Utils.ThemeColor.getRgbColor({color: '000000', effectId: 29}));
else
stroke.put_color(Common.Utils.ThemeColor.getRgbColor(Common.Utils.ThemeColor.colorValue2EffectId(_borderColor)));
stroke.put_width(value * 25.4 / 72.0);
}
shape.put_stroke(stroke);
me.api.ShapeApply(shape);
me._initBorderColorView(); // when select STROKE_NONE or change from STROKE_NONE to STROKE_COLOR
},
onBorderSizeChanging: function (e) {
......@@ -350,8 +349,9 @@ define([
var me = this;
$('#edit-shape-bordercolor .color-preview').css('background-color', ('transparent' == color) ? color : ('#' + (_.isObject(color) ? color.color : color)));
_borderColor = color;
if (me.api && _shapeObject) {
if (me.api && _shapeObject && _shapeObject.get_stroke().get_type() == Asc.c_oAscStrokeType.STROKE_COLOR) {
var shape = new Asc.asc_CShapeProperty(),
stroke = new Asc.asc_CStroke();
......
......@@ -69,14 +69,19 @@ define([
return _sizes[index];
},
sizeByValue: function (value) {
indexSizeByValue: function (value) {
var index = 0;
_.each(_sizes, function (size, idx) {
if (Math.abs(size - value) < 0.25) {
index = idx;
}
});
return _sizes[index];
return index
},
sizeByValue: function (value) {
return _sizes[this.indexSizeByValue(value)];
}
}
})();
......@@ -212,25 +217,29 @@ define([
// Init border
var borderSize = shapeProperties.get_stroke().get_width() * 72.0 / 25.4;
$('#edit-chart-bordersize input').val([borderSizeTransform.sizeByIndex(borderSize)]);
$('#edit-chart-bordersize .item-after').text(borderSizeTransform.sizeByValue(borderSize) + ' ' + _metricText);
var borderSize = shapeProperties.get_stroke().get_width() * 72.0 / 25.4,
borderType = shapeProperties.get_stroke().get_type();
$('#edit-chart-bordersize input').val([(borderType == Asc.c_oAscStrokeType.STROKE_NONE) ? 0 : borderSizeTransform.indexSizeByValue(borderSize)]);
$('#edit-chart-bordersize .item-after').text(((borderType == Asc.c_oAscStrokeType.STROKE_NONE) ? 0 : borderSizeTransform.sizeByValue(borderSize)) + ' ' + _metricText);
$('#edit-chart-bordersize input').single('change touchend', _.buffered(me.onBorderSize, 100, me));
$('#edit-chart-bordersize input').single('input', _.bind(me.onBorderSizeChanging, me));
var stroke = shapeProperties.get_stroke(),
strokeType = stroke.get_type();
// Init border color
me._initBorderColorView();
},
if (stroke && strokeType == Asc.c_oAscStrokeType.STROKE_COLOR) {
_borderInfo.color = me._sdkToThemeColor(stroke.get_color());
}
_initBorderColorView: function () {
var me = this,
stroke = _shapeObject.get_ShapeProperties().get_stroke();
_borderInfo.color = (stroke && stroke.get_type() == Asc.c_oAscStrokeType.STROKE_COLOR) ? me._sdkToThemeColor(stroke.get_color()) : 'transparent';
$('#edit-chart-bordercolor .color-preview').css('background-color',
('transparent' == _borderInfo.color)
? _borderInfo.color
: ('#' + (_.isObject(_borderInfo.color) ? _borderInfo.color.color : _borderInfo.color))
)
);
},
initLayoutPage: function () {
......@@ -618,29 +627,20 @@ define([
var me = this,
$target = $(e.currentTarget),
value = $target.val(),
currentShape = _shapeObject.get_ShapeProperties(),
image = new Asc.asc_CImgProperty(),
shape = new Asc.asc_CShapeProperty(),
stroke = new Asc.asc_CStroke(),
currentColor = Common.Utils.ThemeColor.getRgbColor('000000');
stroke = new Asc.asc_CStroke();
value = borderSizeTransform.sizeByIndex(parseInt(value));
var currentStroke = currentShape.get_stroke();
if (currentStroke) {
var currentStrokeType = currentStroke.get_type();
if (currentStrokeType == Asc.c_oAscStrokeType.STROKE_COLOR) {
currentColor = currentStroke.get_color();
}
}
if (value < 0.01) {
stroke.put_type(Asc.c_oAscStrokeType.STROKE_NONE);
} else {
stroke.put_type(Asc.c_oAscStrokeType.STROKE_COLOR);
stroke.put_color(currentColor);
if (_borderInfo.color == 'transparent')
stroke.put_color(Common.Utils.ThemeColor.getRgbColor({color: '000000', effectId: 29}));
else
stroke.put_color(Common.Utils.ThemeColor.getRgbColor(Common.Utils.ThemeColor.colorValue2EffectId(_borderInfo.color)));
stroke.put_width(value * 25.4 / 72.0);
}
......@@ -648,6 +648,7 @@ define([
image.put_ShapeProperties(shape);
me.api.asc_setGraphicObjectProps(image);
me._initBorderColorView(); // when select STROKE_NONE or change from STROKE_NONE to STROKE_COLOR
},
onBorderSizeChanging: function (e) {
......@@ -660,14 +661,13 @@ define([
currentShape = _shapeObject.get_ShapeProperties();
$('#edit-chart-bordercolor .color-preview').css('background-color', ('transparent' == color) ? color : ('#' + (_.isObject(color) ? color.color : color)));
_borderInfo.color = color;
if (me.api && currentShape) {
if (me.api && currentShape && currentShape.get_stroke().get_type() == Asc.c_oAscStrokeType.STROKE_COLOR) {
var image = new Asc.asc_CImgProperty(),
shape = new Asc.asc_CShapeProperty(),
stroke = new Asc.asc_CStroke();
_borderInfo.color = Common.Utils.ThemeColor.getRgbColor(color);
if (currentShape.get_stroke().get_width() < 0.01) {
stroke.put_type(Asc.c_oAscStrokeType.STROKE_NONE);
} else {
......
......@@ -67,14 +67,19 @@ define([
return _sizes[index];
},
sizeByValue: function (value) {
indexSizeByValue: function (value) {
var index = 0;
_.each(_sizes, function (size, idx) {
if (Math.abs(size - value) < 0.25) {
index = idx;
}
});
return _sizes[index];
return index;
},
sizeByValue: function (value) {
return _sizes[this.indexSizeByValue(value)];
}
}
})();
......@@ -173,25 +178,16 @@ define([
// Init border
var borderSize = this._mm2pt(shapeProperties.get_stroke().get_width());
$('#edit-shape-bordersize input').val([borderSizeTransform.sizeByIndex(borderSize)]);
$('#edit-shape-bordersize .item-after').text(borderSizeTransform.sizeByValue(borderSize) + ' ' + _metricText);
var borderSize = me._mm2pt(shapeProperties.get_stroke().get_width()),
borderType = shapeProperties.get_stroke().get_type();
$('#edit-shape-bordersize input').val([(borderType == Asc.c_oAscStrokeType.STROKE_NONE) ? 0 : borderSizeTransform.indexSizeByValue(borderSize)]);
$('#edit-shape-bordersize .item-after').text(((borderType == Asc.c_oAscStrokeType.STROKE_NONE) ? 0 : borderSizeTransform.sizeByValue(borderSize)) + ' ' + _metricText);
$('#edit-shape-bordersize input').single('change touchend', _.buffered(me.onBorderSize, 100, me));
$('#edit-shape-bordersize input').single('input', _.bind(me.onBorderSizeChanging, me));
var stroke = shapeProperties.get_stroke(),
strokeType = stroke.get_type();
if (stroke && strokeType == Asc.c_oAscStrokeType.STROKE_COLOR) {
_borderInfo.color = me._sdkToThemeColor(stroke.get_color());
}
$('#edit-shape-bordercolor .color-preview').css('background-color',
('transparent' == _borderInfo.color)
? _borderInfo.color
: ('#' + (_.isObject(_borderInfo.color) ? _borderInfo.color.color : _borderInfo.color))
)
// Init border color
me._initBorderColorView();
// Effect
// Init style opacity
......@@ -201,6 +197,19 @@ define([
$('#edit-shape-effect input').single('input', _.bind(me.onOpacityChanging, me));
},
_initBorderColorView: function () {
var me = this,
stroke = _shapeObject.get_ShapeProperties().get_stroke();
_borderInfo.color = (stroke && stroke.get_type() == Asc.c_oAscStrokeType.STROKE_COLOR) ? me._sdkToThemeColor(stroke.get_color()) : 'transparent';
$('#edit-shape-bordercolor .color-preview').css('background-color',
('transparent' == _borderInfo.color)
? _borderInfo.color
: ('#' + (_.isObject(_borderInfo.color) ? _borderInfo.color.color : _borderInfo.color))
);
},
initReplacePage: function () {
$('.shape-replace li').single('click', _.buffered(this.onReplace, 100, this));
},
......@@ -263,36 +272,28 @@ define([
var me = this,
$target = $(e.currentTarget),
value = $target.val(),
currentShape = _shapeObject.get_ShapeProperties(),
image = new Asc.asc_CImgProperty(),
shape = new Asc.asc_CShapeProperty(),
stroke = new Asc.asc_CStroke(),
currentColor = Common.Utils.ThemeColor.getRgbColor('000000');
stroke = new Asc.asc_CStroke();
value = borderSizeTransform.sizeByIndex(parseInt(value));
var currentStroke = currentShape.get_stroke();
if (currentStroke) {
var currentStrokeType = currentStroke.get_type();
if (currentStrokeType == Asc.c_oAscStrokeType.STROKE_COLOR) {
currentColor = currentStroke.get_color();
}
}
if (value < 0.01) {
stroke.put_type(Asc.c_oAscStrokeType.STROKE_NONE);
} else {
stroke.put_type(Asc.c_oAscStrokeType.STROKE_COLOR);
stroke.put_color(currentColor);
stroke.put_width(this._pt2mm(value));
if (_borderInfo.color == 'transparent')
stroke.put_color(Common.Utils.ThemeColor.getRgbColor({color: '000000', effectId: 29}));
else
stroke.put_color(Common.Utils.ThemeColor.getRgbColor(Common.Utils.ThemeColor.colorValue2EffectId(_borderInfo.color)));
stroke.put_width(me._pt2mm(value));
}
shape.put_stroke(stroke);
image.asc_putShapeProperties(shape);
me.api.asc_setGraphicObjectProps(image);
me._initBorderColorView(); // when select STROKE_NONE or change from STROKE_NONE to STROKE_COLOR
},
onBorderSizeChanging: function (e) {
......@@ -350,8 +351,9 @@ define([
currentShape = _shapeObject.get_ShapeProperties();
$('#edit-shape-bordercolor .color-preview').css('background-color', ('transparent' == color) ? color : ('#' + (_.isObject(color) ? color.color : color)));
_borderInfo.color = color;
if (me.api && currentShape) {
if (me.api && currentShape && currentShape.get_stroke().get_type() == Asc.c_oAscStrokeType.STROKE_COLOR) {
var image = new Asc.asc_CImgProperty(),
shape = new Asc.asc_CShapeProperty(),
stroke = new Asc.asc_CStroke();
......@@ -370,8 +372,6 @@ define([
me.api.asc_setGraphicObjectProps(image);
}
},
// API handlers
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment