diff --git a/sigui.nimble b/sigui.nimble index db54e94..139ada3 100644 --- a/sigui.nimble +++ b/sigui.nimble @@ -6,7 +6,7 @@ srcDir = "src" requires "nim >= 2.0.8" requires "fusion" # to write macros using pattern matching -requires "siwin >= 0.9" # to make window +requires "siwin >= 0.9.1" # to make window # optional: requires "imageman" # to decode png requires "bumpy" # for rects requires "opengl" # for graphics diff --git a/src/sigui/mouseArea.nim b/src/sigui/mouseArea.nim index 8a78290..f1615c5 100644 --- a/src/sigui/mouseArea.nim +++ b/src/sigui/mouseArea.nim @@ -27,7 +27,7 @@ type ## mouse button pressed and released inside this area (also if pressed, leaved, re-entered and released) dragged* {.deprecated #[use grabbed instead]#.}: Event[IVec2] - grabbed*: Event[IVec2] + grabbed*: Event[Vec2] ## mouse pressed and started moving while in this area ## emits start position (relative to screen) ## see mouseX and mouseY for current position @@ -45,7 +45,7 @@ type ## cursor for mouse when inside this area pressedButtons: set[MouseButton] - pressedPos: IVec2 + pressedPos: Vec2 grabStarted: bool proc initRedrawWhenPropertyChanged_ignore(t: type MouseArea, name: string): bool = @@ -121,7 +121,7 @@ method recieve*(this: MouseArea, signal: Signal) = if this.hovered[]: this.pressedButtons.incl e.button this.pressed[] = true - this.pressedPos = e.window.mouse.pos + e.window.pos + this.pressedPos = e.window.mouse.pos + e.window.pos.vec2 else: this.pressedButtons.excl e.button if this.pressedButtons == {}: diff --git a/src/sigui/textArea.nim b/src/sigui/textArea.nim index 991745e..a9de3e0 100644 --- a/src/sigui/textArea.nim +++ b/src/sigui/textArea.nim @@ -239,9 +239,9 @@ method recieve*(this: TextArea, signal: Signal) = if window.keyboard.pressed.containsControl(): # when crl+c pressed and copyingUsingCtrlC enabled # copy selected text if this.selectionStart[] != this.selectionEnd[]: - globalClipboard.text = this.selectedText + this.parentWindow.clipboard.text = this.selectedText else: - globalClipboard.text = this.text[] + this.parentWindow.clipboard.text = this.text[] of Key.v: if pastingUsingCtrlV in this.allowedInteractions: @@ -251,7 +251,7 @@ method recieve*(this: TextArea, signal: Signal) = this.pushState() this.eraseSelectedText() - let ct = globalClipboard.text + let ct = this.parentWindow.clipboard.text let offset = this.text.runeOffset(this.cursorPos[]) this.text{}.insert(ct, (if offset == -1: this.text.len else: offset)) this.text.changed.emit() @@ -266,7 +266,7 @@ method recieve*(this: TextArea, signal: Signal) = if this.selectionStart[] != this.selectionEnd[]: if savingUndoStates in this.allowedInteractions: this.pushState() - globalClipboard.text = this.selectedText + this.parentWindow.clipboard.text = this.selectedText this.eraseSelectedText() of Key.z: diff --git a/src/sigui/uibase.nim b/src/sigui/uibase.nim index ef2b3f5..e335fb8 100644 --- a/src/sigui/uibase.nim +++ b/src/sigui/uibase.nim @@ -216,9 +216,6 @@ var registredReflection {.compileTime.}: seq[tuple[f: NimNode, filter: NimNode]] # callable syms -var globalClipboard* = siwin.clipboard() - - proc vec4*(color: chroma.Color): Vec4 = vec4(color.r, color.g, color.b, color.a)