mirror of
https://github.com/wavetermdev/wails.git
synced 2026-08-05 13:53:43 -07:00
[v3 windows] Support setURL, execJS, reload, zoomIn/Out/Reset, get/setZoom, setHTML,
This commit is contained in:
+8
-8
@@ -31,11 +31,11 @@ Webview Window Interface Methods
|
||||
| center() | Y | | Y | |
|
||||
| close() | | | Y | |
|
||||
| destroy() | | | Y | |
|
||||
| execJS(js string) | | | Y | |
|
||||
| execJS(js string) | Y | | Y | |
|
||||
| focus() | Y | | Y | |
|
||||
| forceReload() | | | Y | |
|
||||
| fullscreen() | Y | | Y | |
|
||||
| getScreen() (*Screen, error) | | | Y | |
|
||||
| getScreen() (*Screen, error) | Y | | Y | |
|
||||
| getZoom() float64 | | | Y | |
|
||||
| height() int | Y | | Y | |
|
||||
| hide() | Y | | Y | |
|
||||
@@ -45,7 +45,7 @@ Webview Window Interface Methods
|
||||
| maximise() | Y | | Y | |
|
||||
| minimise() | Y | | Y | |
|
||||
| nativeWindowHandle() (uintptr, error) | Y | | Y | |
|
||||
| on(eventID uint) | | | Y | |
|
||||
| on(eventID uint) | Y | | Y | |
|
||||
| openContextMenu(menu *Menu, data *ContextMenuData) | | | Y | |
|
||||
| position() (int, int) | Y | | Y | |
|
||||
| reload() | | | Y | |
|
||||
@@ -61,8 +61,8 @@ Webview Window Interface Methods
|
||||
| setResizable(resizable bool) | Y | | Y | |
|
||||
| setSize(width, height int) | Y | | Y | |
|
||||
| setTitle(title string) | Y | | Y | |
|
||||
| setURL(url string) | | | Y | |
|
||||
| setZoom(zoom float64) | | | Y | |
|
||||
| setURL(url string) | Y | | Y | |
|
||||
| setZoom(zoom float64) | Y | | Y | |
|
||||
| show() | Y | | Y | |
|
||||
| size() (int, int) | Y | | Y | |
|
||||
| toggleDevTools() | | | Y | |
|
||||
@@ -71,9 +71,9 @@ Webview Window Interface Methods
|
||||
| unminimise() | Y | | Y | |
|
||||
| width() int | Y | | Y | |
|
||||
| zoom() | | | Y | |
|
||||
| zoomIn() | | | Y | |
|
||||
| zoomOut() | | | Y | |
|
||||
| zoomReset() | | | Y | |
|
||||
| zoomIn() | Y | | Y | |
|
||||
| zoomOut() | Y | | Y | |
|
||||
| zoomReset() | Y | | Y | |
|
||||
|
||||
## Runtime
|
||||
|
||||
|
||||
@@ -69,8 +69,8 @@ func (w *windowsWebviewWindow) setAlwaysOnTop(alwaysOnTop bool) {
|
||||
}
|
||||
|
||||
func (w *windowsWebviewWindow) setURL(url string) {
|
||||
//TODO implement me
|
||||
panic("implement me")
|
||||
// Navigate to the given URL in the webview
|
||||
w.chromium.Navigate(url)
|
||||
}
|
||||
|
||||
func (w *windowsWebviewWindow) setResizable(resizable bool) {
|
||||
@@ -88,8 +88,7 @@ func (w *windowsWebviewWindow) setMaxSize(width, height int) {
|
||||
}
|
||||
|
||||
func (w *windowsWebviewWindow) execJS(js string) {
|
||||
//TODO implement me
|
||||
panic("implement me")
|
||||
w.chromium.Eval(js)
|
||||
}
|
||||
|
||||
func (w *windowsWebviewWindow) setBackgroundColour(color RGBA) {
|
||||
@@ -298,8 +297,7 @@ func (w *windowsWebviewWindow) destroy() {
|
||||
}
|
||||
|
||||
func (w *windowsWebviewWindow) reload() {
|
||||
//TODO implement me
|
||||
panic("implement me")
|
||||
w.execJS("window.location.reload();")
|
||||
}
|
||||
|
||||
func (w *windowsWebviewWindow) forceReload() {
|
||||
@@ -313,28 +311,44 @@ func (w *windowsWebviewWindow) toggleDevTools() {
|
||||
}
|
||||
|
||||
func (w *windowsWebviewWindow) zoomReset() {
|
||||
//TODO implement me
|
||||
panic("implement me")
|
||||
w.setZoom(1.0)
|
||||
}
|
||||
|
||||
func (w *windowsWebviewWindow) zoomIn() {
|
||||
//TODO implement me
|
||||
panic("implement me")
|
||||
// Increase the zoom level by 0.05
|
||||
currentZoom := w.getZoom()
|
||||
if currentZoom == -1 {
|
||||
return
|
||||
}
|
||||
w.setZoom(currentZoom + 0.05)
|
||||
}
|
||||
|
||||
func (w *windowsWebviewWindow) zoomOut() {
|
||||
//TODO implement me
|
||||
panic("implement me")
|
||||
// Decrease the zoom level by 0.05
|
||||
currentZoom := w.getZoom()
|
||||
if currentZoom == -1 {
|
||||
return
|
||||
}
|
||||
if currentZoom > 1.05 {
|
||||
// Decrease the zoom level by 0.05
|
||||
w.setZoom(currentZoom - 0.05)
|
||||
} else {
|
||||
// Set the zoom level to 1.0
|
||||
w.setZoom(1.0)
|
||||
}
|
||||
}
|
||||
|
||||
func (w *windowsWebviewWindow) getZoom() float64 {
|
||||
//TODO implement me
|
||||
panic("implement me")
|
||||
controller := w.chromium.GetController()
|
||||
factor, err := controller.GetZoomFactor()
|
||||
if err != nil {
|
||||
return -1
|
||||
}
|
||||
return factor
|
||||
}
|
||||
|
||||
func (w *windowsWebviewWindow) setZoom(zoom float64) {
|
||||
//TODO implement me
|
||||
panic("implement me")
|
||||
w.chromium.PutZoomFactor(zoom)
|
||||
}
|
||||
|
||||
func (w *windowsWebviewWindow) close() {
|
||||
@@ -348,8 +362,8 @@ func (w *windowsWebviewWindow) zoom() {
|
||||
}
|
||||
|
||||
func (w *windowsWebviewWindow) setHTML(html string) {
|
||||
//TODO implement me
|
||||
panic("implement me")
|
||||
// Render the given HTML in the webview window
|
||||
w.execJS(fmt.Sprintf("document.documentElement.innerHTML = %q;", html))
|
||||
}
|
||||
|
||||
func (w *windowsWebviewWindow) setPosition(x int, y int) {
|
||||
|
||||
Reference in New Issue
Block a user