Skip to content
This repository has been archived by the owner on Feb 13, 2024. It is now read-only.

Commit

Permalink
feat(config): rename defaultConfig.json to defaultConfig.js, remove m…
Browse files Browse the repository at this point in the history
…obileShow&mobileScale(use displ

prototype

BREAKING CHANGE: rename defaultConfig.json to defaultConfig.js, remove mobileShow&mobileScale(use
displayFunc instead), remove modelScale(nouse), add z-index&displayFunc

re #19
  • Loading branch information
xiazeyu committed Aug 26, 2018
1 parent 0c09af4 commit 476bd71
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 27 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ javascript:function loadScript(c,b){var a=document.createElement("script");a.typ

See the [document](https://l2dwidget.js.org/docs/typedef/index.html#static-typedef-Config).

Default settings are at[defaultConfig.json](https://cdn.jsdelivr.net/npm/live2d-widget@4/dist/defaultConfig.json).
Default settings are at[defaultConfig.js](https://cdn.jsdelivr.net/npm/live2d-widget@4/dist/defaultConfig.js).

Enjoy!:beer:

Expand Down
8 changes: 4 additions & 4 deletions build/afterBuild.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@ const fs = require('fs');
const path = require('path');
const getProjPath = require('./getProjPath');

// Copy defaultConfig.json
// Copy defaultConfig.js
getProjPath((projPath) => {

fs.copyFile(path.resolve(projPath, 'src/config/defaultConfig.json'), path.resolve(projPath, 'dist/defaultConfig.json'), (err) => {
fs.copyFile(path.resolve(projPath, 'src/config/defaultConfig.js'), path.resolve(projPath, 'dist/defaultConfig.js'), (err) => {

if (err) {

console.error('Failed copying defaultConfig.json');
console.error('Failed copying defaultConfig.js');
throw err;

}
console.log('succeeded copying defaultConfig.json');
console.log('succeeded copying defaultConfig.js');

});

Expand Down
3 changes: 1 addition & 2 deletions src/config/configMgr.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import defaultConfig from './defaultConfig';

/**
* @typedef {Object} Config
* @desc The object structure for config. Default config sees [dist/defaultConfig.json](https://cdn.jsdelivr.net/npm/live2d-widget/dist/defaultConfig.json).
* @desc The object structure for config. Default config sees [dist/defaultConfig.js](https://cdn.jsdelivr.net/npm/live2d-widget/dist/defaultConfig.js).
* @property {String} modelJsonPath="https://cdn.jsdelivr.net/npm/live2d-widget-model-shizuku/assets/shizuku.model.json" Specifies the path to `.model.json`. 模型`.model.json`文件路径 <br> eg. `"/live2d/miku.model.json"`<br>`"https://test.com/live2d/miku.model.json"`<br>`"http://test.com/live2d/miku.model.json"`<br>`"file:///d:/live2d/miku.model.json"`
* @property {String} displayWidth="150px" Specifies the width of actual widget element. 插件宽度 <br> eg. `150` == `"150px"`, `"35%"`, `"auto"` <br> *used as canvas.element.width.*
* @property {String} displaySide="right" Specifies left or right side to show. 左右侧显示位置 <br> eg. `"left"`, `"right"`
Expand All @@ -16,7 +16,6 @@ import defaultConfig from './defaultConfig';
* @property {Number} displaySampleLevel Sampling level. 采样等级
* @property {Number} displayOffsetV Vertical offset of canvas. canvas垂直偏移
* @property {Number} displayOffsetH Horizontal offset of canvas. canvas水平偏移
* @property {Boolean} mobileShow If show on mobile device. 是否在移动设备上显示
* @property {Boolean} mobileMotion If enable motion reaction on mobile devices. 是否在移动设备上开启运动响应
* @property {Boolean} devMouseLog=false If shows mouse log. 显示鼠标日志
* @property {Boolean} devLog=false If shows log. 显示日志
Expand Down
30 changes: 30 additions & 0 deletions src/config/defaultConfig.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
export default {
'devLog': false,
'devMouseLog': false,
'displayFunc': () => ({
'displayHeight': null,
'displayMotion': null,
'displayOffsetH': null,
'displayOffsetV': null,
'displayOpacityDefault': null,
'displayOpacityOnHover': null,
'displaySampleLevel': null,
'displayShow': null,
'displaySide': null,
'displayWidth': null,
}),
'displayHeight': '300px',
'displayMotion': true,
'displayOffsetH': 0,
'displayOffsetV': -20,
'displayOpacityDefault': 0.7,
'displayOpacityOnHover': 0.2,
'displaySampleLevel': 2,
'displayShow': true,
'displaySide': 'right',
'displayWidth': '150px',
'modelHeadPosH': 0.5,
'modelHeadPosV': 0.618,
'modelJsonPath': 'https://cdn.jsdelivr.net/npm/live2d-widget-model-shizuku/assets/shizuku.model.json',
'z-index': 2333,
};
19 changes: 0 additions & 19 deletions src/config/defaultConfig.json

This file was deleted.

2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* global process, device */
/* global process */

import {
configDefaulter,
Expand Down

0 comments on commit 476bd71

Please sign in to comment.