Skip to content

Commit

Permalink
ULMS-2986 Fixed stamp duplication
Browse files Browse the repository at this point in the history
  • Loading branch information
alexkonst committed Jun 10, 2024
1 parent 124d2a2 commit 08e1fea
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 12 deletions.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/drawing/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ulms/ui-drawing",
"version": "3.5.1",
"version": "3.5.2",
"license": "MIT",
"main": "index.js",
"module": "es/index.js",
Expand Down
7 changes: 4 additions & 3 deletions packages/drawing/src/cursor-provider.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,20 @@ class CCursorProvider {

setCursor(cursorObject, adjustPoint = '-0.5 -0.5') {
this._clearCursor()

if (cursorObject) {
cursorObject.clone((object) => {
this.__cursor = object || null

if (this.__cursor) {
this.__adjustPoint = adjustPoint

makeNotInteractive(this.__cursor)

this.__cursor.set('_draft', true)
this.__cursor.set('opacity', 0.5)
}
})
} else {
this.__cursor = null
}
}

Expand Down Expand Up @@ -64,7 +65,7 @@ class CCursorProvider {
}

show() {
if (this.__canvas && this.__cursor) {
if (this.__canvas && this.__cursor && this.__cursorOnBoard) {
this.__canvas.add(this.__cursor)
}
}
Expand Down
12 changes: 5 additions & 7 deletions packages/drawing/src/tools/stamp.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@ export class StampTool extends PositionableObject {
this.#image = null

this.#publicStorage = publicStorageProvider

this._cursorString = `url("${this.#publicStorage.getUrl(
this.#publicStorage.types.STAMP,
cursorName,
)}") 5 19, crosshair`
}

configure(props) {
Expand All @@ -57,13 +62,6 @@ export class StampTool extends PositionableObject {
this._canvas.setCursor(this._cursorString)
}

get _cursorString() {
return `url("${this.#publicStorage.getUrl(
this.#publicStorage.types.STAMP,
cursorName,
)}") 5 19, crosshair`
}

_onLoad = (image) => {
if (image) {
CursorProvider.setCursor(image, '-1 0')
Expand Down

0 comments on commit 08e1fea

Please sign in to comment.