diff --git a/packages/core/plugin/QrCodePlugin.ts b/packages/core/plugin/QrCodePlugin.ts
index bce2f97b..98b2a1ea 100644
--- a/packages/core/plugin/QrCodePlugin.ts
+++ b/packages/core/plugin/QrCodePlugin.ts
@@ -69,11 +69,11 @@ class QrCodePlugin implements IPluginTempl {
width: 300,
margin: 10,
errorCorrectionLevel: 'M',
- dotsColor: 'black',
+ dotsColor: '#000000',
dotsType: 'rounded',
- cornersSquareColor: 'black',
+ cornersSquareColor: '#000000',
cornersSquareType: 'square',
- cornersDotColor: 'black',
+ cornersDotColor: '#000000',
cornersDotType: 'square',
background: '#ffffff',
};
diff --git a/src/components/attributeColor.vue b/src/components/attributeColor.vue
index 9fc64aa5..5e5e913e 100644
--- a/src/components/attributeColor.vue
+++ b/src/components/attributeColor.vue
@@ -15,9 +15,19 @@
mixinState.mSelectOneType !== 'group'
"
>
- 颜色
+
+
+
+
+ 颜色
+
+
+ 纹理
+
+
+
-
+
+
+
+
+
+
+
+
@@ -46,7 +72,29 @@ const angleKey = 'gradientAngle';
const baseAttr = reactive({
fill: '#ffffffff',
});
-
+const colorShow = ref(true);
+const fontTextureList = reactive([
+ {
+ label: 'repeat',
+ value: 'repeat',
+ },
+ {
+ label: 'repeat-x',
+ value: 'repeat-x',
+ },
+ {
+ label: 'repeat-y',
+ value: 'repeat-y',
+ },
+ {
+ label: 'no-repeat',
+ value: 'no-repeat',
+ },
+]);
+const fontTextureDirection = ref('repeat');
+const colorshowChange = () => {
+ colorShow.value = !colorShow.value;
+};
// 属性获取
const getObjectAttr = (e) => {
const activeObject = canvasEditor.canvas.getActiveObject();
@@ -54,14 +102,47 @@ const getObjectAttr = (e) => {
if (e && e.target && e.target !== activeObject) return;
if (activeObject && mixinState.mSelectMode === 'one') {
const fill = activeObject.get('fill');
- if (typeof fill === 'string') {
+ if (typeof fill === 'string' && !fill.source) {
baseAttr.fill = fill;
- } else {
+ } else if (!fill.source) {
baseAttr.fill = fabricGradientToCss(fill, activeObject);
+ } else {
+ colorShow.value = false;
+ return;
}
}
};
+const updateTexture = (event, file, fileList) => {
+ const reader = new FileReader();
+ reader.onload = function (e) {
+ const activeObject = canvasEditor.canvas.getActiveObject();
+ fabric.util.loadImage(e.target.result, function (img) {
+ activeObject.set(
+ 'fill',
+ new fabric.Pattern({
+ source: img,
+ repeat: fontTextureDirection.value,
+ })
+ );
+ canvasEditor.canvas.renderAll();
+ });
+ };
+ reader.readAsDataURL(fileList);
+};
+
+const changeTexture = () => {
+ const activeObject = canvasEditor.canvas.getActiveObject();
+ activeObject.set(
+ 'fill',
+ new fabric.Pattern({
+ source: activeObject.fill.source,
+ repeat: fontTextureDirection.value,
+ })
+ );
+ canvasEditor.canvas.renderAll();
+};
+
const colorChange = (value) => {
const activeObject = canvasEditor.canvas.getActiveObjects()[0];
if (activeObject) {
@@ -89,6 +170,7 @@ const dropColor = (value) => {
const fabricGradientToCss = (val, activeObject) => {
// 渐变类型
if (!val) return;
+ if (activeObject.fill.source) return;
const angle = activeObject.get(angleKey, val.degree);
const colorStops = val.colorStops.map((item) => {
return item.color + ' ' + item.offset * 100 + '%';
@@ -147,6 +229,7 @@ onBeforeUnmount(() => {
cursor: pointer;
border: 2px solid #f6f7f9;
}
+
:deep(.ivu-input-number) {
display: block;
width: 100%;
@@ -155,6 +238,7 @@ onBeforeUnmount(() => {
:deep(.ivu-tooltip) {
display: flex;
}
+
.ivu-form-item {
background: #f6f7f9;
border-radius: 5px;