Commit e661981b authored by 李维's avatar 李维

增加绘图按钮位置可配置

parent 3215a93b
......@@ -64,8 +64,8 @@ export default class DrawingBoard extends cc.Component {
// @property(cc.Label)
// label: cc.Label = null;
// @property
// text: string = 'hello';
@property
painterOnCenter: boolean = false;
// LIFE-CYCLE CALLBACKS:
......@@ -141,7 +141,18 @@ export default class DrawingBoard extends cc.Component {
bgPalette.active = false;
})
const painterBtn = cc.find("btnStartPaint", this.node)
const painterBtnTop = cc.find("ToolBox/Painter", this.node)
const painterBtnCenter = cc.find("btnStartPaint", this.node)
let painterBtn = null;
if(this.painterOnCenter) {
painterBtn = painterBtnCenter;
painterBtnTop.active = false;
} else {
painterBtn = painterBtnTop;
painterBtnCenter.active = false;
}
painterBtn.on("click", ()=>{
eraserBtn.active = true; // 显示橡皮按钮
painterBtn.active = false; // 隐藏画笔按钮
......@@ -218,8 +229,17 @@ export default class DrawingBoard extends cc.Component {
}
initEventListener() {
const toolBox = cc.find("ToolBox", this.node)
const painterBtn = cc.find("btnStartPaint", this.node)
const toolBox = cc.find("ToolBox", this.node);
const painterBtnTop = cc.find("ToolBox/Painter", this.node)
const painterBtnCenter = cc.find("btnStartPaint", this.node)
let painterBtn = null;
if(this.painterOnCenter) {
painterBtn = painterBtnCenter;
} else {
painterBtn = painterBtnTop;
}
this.node.on("enable", ()=>{
toolBox.active = true;
painterBtn.active = true;
......
This diff is collapsed.
......@@ -3125,6 +3125,8 @@ export default class SceneComponent extends MyCocosSceneComponent {
setDrawingArea(contentData, hotZoneItemData, debugMode=false) {
const rect = this.newRectNode(hotZoneItemData, layer_4, debugMode);
const drawingBoard = cc.instantiate(this.drawingBoardTemplate);
const dbJS = drawingBoard.getComponent("DrawingBoard_DG_FAF")
dbJS.painterOnCenter = contentData.painterOnCenter ? true : false;
const uid = getUUID();
drawingBoard.uid = uid;
this.allDrawingBoards.push(drawingBoard);
......@@ -3163,6 +3165,8 @@ export default class SceneComponent extends MyCocosSceneComponent {
setDrawingAreaWithCheck(contentData, hotZoneItemData, debugMode=false) {
const rect = this.newRectNode(hotZoneItemData, layer_4, debugMode);
const drawingBoard = cc.instantiate(this.drawingBoardTemplate);
const dbJS = drawingBoard.getComponent("DrawingBoard_DG_FAF")
dbJS.painterOnCenter = contentData.painterOnCenter ? true : false;
const uid = getUUID();
drawingBoard.uid = uid;
this.allDrawingBoards.push(drawingBoard);
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -610,6 +610,11 @@
<label nz-checkbox [(ngModel)]="it.drawingCheckStrictEqual" (ngModelChange)="save()" style="margin-left: 10px;">颜色严格相等</label>
</div>
<div *ngIf="it.hotZoneType == DRAWING || it.hotZoneType == DRAWING_CHECK" style="margin: 10px 10px;">
<span style="display: inline-block; text-align: right; width: 150px;">绘图按钮在中间:</span>
<label nz-checkbox [(ngModel)]="it.painterOnCenter" (ngModelChange)="save()" style="margin-left: 10px;"></label>
</div>
<div *ngIf="it.hotZoneType != '' && it.hotZoneType != CROSSWORD_PUZZLE && it.hotZoneType != HOT_ZONE_RADIO && it.hotZoneType != HOT_ZONE_CHECKBOX && it.hotZoneType != CONNECTION && it.hotZoneType != CONNECTION_2LEVEL && it.hotZoneType != TEXT_SELECT && it.hotZoneType != MULTIPLE_TEXT_SELECT && it.hotZoneType != RIGHT_OR_WRONG && it.hotZoneType != TEXTINPUT_GROUP" style="margin: 10px 10px;">
<span style="display: inline-block; text-align: right; width: 150px;">关联热区:</span>
<nz-select nzShowSearch nzAllowClear [(ngModel)]="it.linkHotZoneIndex" style="width: 300px;" (ngModelChange)="save()">
......
......@@ -275,6 +275,7 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy, AfterViewIni
drawingCheckCorrectColors: [], // 正确颜色 [评分画图题]
drawingCheckStrictEqual: false, // 严格相等 [评分画图题]
painterOnCenter: false, // 开启绘图按钮在绘画区中间 [评分画图题、画图题]
}
}
......
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