feat:add interface for cypress
This commit is contained in:
@@ -17,6 +17,7 @@ export class Command {
|
|||||||
private static undo: Function
|
private static undo: Function
|
||||||
private static redo: Function
|
private static redo: Function
|
||||||
private static painter: Function
|
private static painter: Function
|
||||||
|
private static applyPainterStyle: Function
|
||||||
private static format: Function
|
private static format: Function
|
||||||
private static font: Function
|
private static font: Function
|
||||||
private static sizeAdd: Function
|
private static sizeAdd: Function
|
||||||
@@ -67,6 +68,7 @@ export class Command {
|
|||||||
Command.undo = adapt.undo.bind(adapt)
|
Command.undo = adapt.undo.bind(adapt)
|
||||||
Command.redo = adapt.redo.bind(adapt)
|
Command.redo = adapt.redo.bind(adapt)
|
||||||
Command.painter = adapt.painter.bind(adapt)
|
Command.painter = adapt.painter.bind(adapt)
|
||||||
|
Command.applyPainterStyle = adapt.applyPainterStyle.bind(adapt)
|
||||||
Command.format = adapt.format.bind(adapt)
|
Command.format = adapt.format.bind(adapt)
|
||||||
Command.font = adapt.font.bind(adapt)
|
Command.font = adapt.font.bind(adapt)
|
||||||
Command.sizeAdd = adapt.sizeAdd.bind(adapt)
|
Command.sizeAdd = adapt.sizeAdd.bind(adapt)
|
||||||
@@ -149,6 +151,10 @@ export class Command {
|
|||||||
return Command.painter()
|
return Command.painter()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public executeApplyPainterStyle() {
|
||||||
|
return Command.applyPainterStyle()
|
||||||
|
}
|
||||||
|
|
||||||
public executeFormat() {
|
public executeFormat() {
|
||||||
return Command.format()
|
return Command.format()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -140,6 +140,10 @@ export class CommandAdapt {
|
|||||||
this.draw.setPainterStyle(painterStyle)
|
this.draw.setPainterStyle(painterStyle)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public applyPainterStyle() {
|
||||||
|
this.canvasEvent.applyPainterStyle()
|
||||||
|
}
|
||||||
|
|
||||||
public format() {
|
public format() {
|
||||||
const isReadonly = this.draw.isReadonly()
|
const isReadonly = this.draw.isReadonly()
|
||||||
if (isReadonly) return
|
if (isReadonly) return
|
||||||
|
|||||||
@@ -68,11 +68,15 @@ export class CanvasEvent {
|
|||||||
|
|
||||||
public setIsAllowDrag(payload: boolean) {
|
public setIsAllowDrag(payload: boolean) {
|
||||||
this.isAllowDrag = payload
|
this.isAllowDrag = payload
|
||||||
if (payload === false) {
|
if (!payload) {
|
||||||
|
this.applyPainterStyle()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public applyPainterStyle() {
|
||||||
this.pageList.forEach(p => {
|
this.pageList.forEach(p => {
|
||||||
p.style.cursor = 'text'
|
p.style.cursor = 'text'
|
||||||
})
|
})
|
||||||
// 应用格式刷样式
|
|
||||||
const painterStyle = this.draw.getPainterStyle()
|
const painterStyle = this.draw.getPainterStyle()
|
||||||
if (!painterStyle) return
|
if (!painterStyle) return
|
||||||
const selection = this.range.getSelection()
|
const selection = this.range.getSelection()
|
||||||
@@ -87,7 +91,6 @@ export class CanvasEvent {
|
|||||||
this.draw.setPainterStyle(null)
|
this.draw.setPainterStyle(null)
|
||||||
this.draw.render({ isSetCursor: false })
|
this.draw.render({ isSetCursor: false })
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public mousemove(evt: MouseEvent) {
|
public mousemove(evt: MouseEvent) {
|
||||||
if (!this.isAllowDrag || !this.mouseDownStartPosition) return
|
if (!this.isAllowDrag || !this.mouseDownStartPosition) return
|
||||||
|
|||||||
Reference in New Issue
Block a user