Open uranusjr opened 11 years ago
一個做法是放一個 setting toggle fixed mode/dynamic mode,然後在 View 裡面放一個 cell width/height getter 的 wrapper。如果是 fixed mode 就用現在的方法,dynamic mode 就是偵測目前視窗大小來換算。在 resizeEvent 裡偵測如果是 dynamic mode 就觸發 redraw。
resizeEvent
仔細想像似乎是沒有想像中難,因為 cellWidth 和 cellHeight 本來就有 cache,只要用 Controller::updateAll 就搞定了。
cellWidth
cellHeight
Controller::updateAll
一個做法是放一個 setting toggle fixed mode/dynamic mode,然後在 View 裡面放一個 cell width/height getter 的 wrapper。如果是 fixed mode 就用現在的方法,dynamic mode 就是偵測目前視窗大小來換算。在
resizeEvent
裡偵測如果是 dynamic mode 就觸發 redraw。仔細想像似乎是沒有想像中難,因為
cellWidth
和cellHeight
本來就有 cache,只要用Controller::updateAll
就搞定了。