mirror of
				https://github.com/SoftFever/OrcaSlicer.git
				synced 2025-10-31 12:41:20 -06:00 
			
		
		
		
	ENH:adjust AMSMaterial clickable region
Change-Id: If81e156fde4f9c724844a7bce6fd97db1d98b4e3
This commit is contained in:
		
							parent
							
								
									9f194263f1
								
							
						
					
					
						commit
						aac23eb6b4
					
				
					 4 changed files with 24 additions and 14 deletions
				
			
		
							
								
								
									
										2
									
								
								resources/images/ams_readonly.svg
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										2
									
								
								resources/images/ams_readonly.svg
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,2 @@ | |||
| <?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1659672294109" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1371" width="16" height="16" xmlns:xlink="http://www.w3.org/1999/xlink"><defs><style type="text/css">@font-face { font-family: feedback-iconfont; src: url("//at.alicdn.com/t/font_1031158_u69w8yhxdu.woff2?t=1630033759944") format("woff2"), url("//at.alicdn.com/t/font_1031158_u69w8yhxdu.woff?t=1630033759944") format("woff"), url("//at.alicdn.com/t/font_1031158_u69w8yhxdu.ttf?t=1630033759944") format("truetype"); } | ||||
| </style></defs><path d="M512 255.78c-194.98 0-360.39 106.95-421.96 256 61.57 149.05 226.98 256 421.96 256s360.39-106.95 421.96-256c-61.57-149.05-226.98-256-421.96-256z m0 448c-106.04 0-192-85.96-192-192s85.96-192 192-192 192 85.96 192 192-85.96 192-192 192z" fill="#323a3d" p-id="1372"></path><path d="M512 511.78m-128 0a128 128 0 1 0 256 0 128 128 0 1 0-256 0Z" fill="#323a3d" p-id="1373"></path></svg> | ||||
| After Width: | Height: | Size: 1 KiB | 
							
								
								
									
										2
									
								
								resources/images/ams_readonly_light.svg
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										2
									
								
								resources/images/ams_readonly_light.svg
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,2 @@ | |||
| <?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1659672294109" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1371" width="16" height="16" xmlns:xlink="http://www.w3.org/1999/xlink"><defs><style type="text/css">@font-face { font-family: feedback-iconfont; src: url("//at.alicdn.com/t/font_1031158_u69w8yhxdu.woff2?t=1630033759944") format("woff2"), url("//at.alicdn.com/t/font_1031158_u69w8yhxdu.woff?t=1630033759944") format("woff"), url("//at.alicdn.com/t/font_1031158_u69w8yhxdu.ttf?t=1630033759944") format("truetype"); } | ||||
| </style></defs><path d="M512 255.78c-194.98 0-360.39 106.95-421.96 256 61.57 149.05 226.98 256 421.96 256s360.39-106.95 421.96-256c-61.57-149.05-226.98-256-421.96-256z m0 448c-106.04 0-192-85.96-192-192s85.96-192 192-192 192 85.96 192 192-85.96 192-192 192z" fill="#ffffff" p-id="1372"></path><path d="M512 511.78m-128 0a128 128 0 1 0 256 0 128 128 0 1 0-256 0Z" fill="#ffffff" p-id="1373"></path></svg> | ||||
| After Width: | Height: | Size: 1 KiB | 
|  | @ -440,7 +440,9 @@ void AMSLib::create(wxWindow *parent, wxWindowID id, const wxPoint &pos, const w | |||
|     wxBoxSizer *m_sizer_edit = new wxBoxSizer(wxHORIZONTAL); | ||||
| 
 | ||||
|     m_bitmap_editable       = ScalableBitmap(this, "ams_editable", 14); | ||||
|     m_bitmap_editable_lifht = ScalableBitmap(this, "ams_editable_light", 14); | ||||
|     m_bitmap_editable_light = ScalableBitmap(this, "ams_editable_light", 14); | ||||
|     m_bitmap_readonly       = ScalableBitmap(this, "ams_readonly", 14); | ||||
|     m_bitmap_readonly_light = ScalableBitmap(this, "ams_readonly_light", 14); | ||||
| 
 | ||||
|     m_sizer_body->Add(0, 0, 1, wxEXPAND, 0); | ||||
|     m_sizer_body->Add(m_sizer_edit, 0, wxALIGN_CENTER, 0); | ||||
|  | @ -467,9 +469,9 @@ void AMSLib::on_left_down(wxMouseEvent &evt) | |||
|     if (m_info.material_state != AMSCanType::AMS_CAN_TYPE_EMPTY && m_info.material_state != AMSCanType::AMS_CAN_TYPE_NONE) { | ||||
|         auto size = GetSize(); | ||||
|         auto pos  = evt.GetPosition(); | ||||
|         if (m_info.material_state == AMSCanType::AMS_CAN_TYPE_THIRDBRAND) { | ||||
|         if (m_info.material_state == AMSCanType::AMS_CAN_TYPE_THIRDBRAND || m_info.material_state == AMSCanType::AMS_CAN_TYPE_BRAND) { | ||||
|             auto left   = FromDIP(20); | ||||
|             auto top    = (size.y - FromDIP(10) - m_bitmap_editable_lifht.GetBmpSize().y); | ||||
|             auto top    = (size.y - FromDIP(10) - m_bitmap_editable_light.GetBmpSize().y); | ||||
|             auto right  = size.x - FromDIP(20); | ||||
|             auto bottom = size.y - FromDIP(10); | ||||
| 
 | ||||
|  | @ -477,9 +479,6 @@ void AMSLib::on_left_down(wxMouseEvent &evt) | |||
|                 post_event(wxCommandEvent(EVT_AMS_ON_FILAMENT_EDIT));  | ||||
|             } | ||||
|         } | ||||
|         if (m_info.material_state == AMSCanType::AMS_CAN_TYPE_BRAND) { | ||||
|             post_event(wxCommandEvent(EVT_AMS_ON_FILAMENT_EDIT)); | ||||
|         } | ||||
|     } | ||||
| } | ||||
| 
 | ||||
|  | @ -569,13 +568,15 @@ void AMSLib::doRender(wxDC &dc) | |||
| { | ||||
|     wxSize size             = GetSize(); | ||||
|     auto   tmp_lib_colour   = m_info.material_colour; | ||||
|     auto   temp_bitmap      = m_bitmap_editable_lifht; | ||||
|     auto   temp_bitmap_third      = m_bitmap_editable_light; | ||||
|     auto   temp_bitmap_brand      = m_bitmap_readonly_light; | ||||
| 
 | ||||
|     if (tmp_lib_colour.GetLuminance() < 0.5) { | ||||
|         temp_bitmap      = m_bitmap_editable_lifht; | ||||
|         temp_bitmap_third = m_bitmap_editable_light; | ||||
|         temp_bitmap_brand = m_bitmap_readonly_light; | ||||
|     } else { | ||||
|         temp_bitmap      = m_bitmap_editable; | ||||
|          | ||||
|         temp_bitmap_third = m_bitmap_editable; | ||||
|         temp_bitmap_brand = m_bitmap_readonly; | ||||
|     } | ||||
| 
 | ||||
|     if (!wxWindow::IsEnabled()) { | ||||
|  | @ -629,9 +630,12 @@ void AMSLib::doRender(wxDC &dc) | |||
|     } | ||||
|      | ||||
|     // edit icon
 | ||||
|     if (m_info.material_state != AMSCanType::AMS_CAN_TYPE_EMPTY && m_info.material_state != AMSCanType::AMS_CAN_TYPE_NONE | ||||
|         && m_info.material_state == AMSCanType::AMS_CAN_TYPE_THIRDBRAND ) { | ||||
|         dc.DrawBitmap(temp_bitmap.bmp(), (size.x - m_bitmap_editable.GetBmpSize().x) / 2, (size.y - FromDIP(10) - temp_bitmap.GetBmpSize().y)); | ||||
|     if (m_info.material_state != AMSCanType::AMS_CAN_TYPE_EMPTY && m_info.material_state != AMSCanType::AMS_CAN_TYPE_NONE) | ||||
|     { | ||||
|         if (m_info.material_state == AMSCanType::AMS_CAN_TYPE_THIRDBRAND) | ||||
|             dc.DrawBitmap(temp_bitmap_third.bmp(), (size.x - temp_bitmap_third.GetBmpSize().x) / 2, (size.y - FromDIP(10) - temp_bitmap_third.GetBmpSize().y)); | ||||
|         if (m_info.material_state == AMSCanType::AMS_CAN_TYPE_BRAND) | ||||
|             dc.DrawBitmap(temp_bitmap_brand.bmp(), (size.x - temp_bitmap_brand.GetBmpSize().x) / 2, (size.y - FromDIP(10) - temp_bitmap_brand.GetBmpSize().y)); | ||||
|     } | ||||
| } | ||||
| 
 | ||||
|  |  | |||
|  | @ -236,7 +236,9 @@ protected: | |||
|     wxStaticBitmap *m_edit_bitmp       = {nullptr}; | ||||
|     wxStaticBitmap *m_edit_bitmp_light = {nullptr}; | ||||
|     ScalableBitmap  m_bitmap_editable; | ||||
|     ScalableBitmap  m_bitmap_editable_lifht; | ||||
|     ScalableBitmap  m_bitmap_editable_light; | ||||
|     ScalableBitmap  m_bitmap_readonly; | ||||
|     ScalableBitmap  m_bitmap_readonly_light; | ||||
|     bool            m_unable_selected = {false}; | ||||
|     bool            m_enable          = {false}; | ||||
|     bool            m_selected        = {false}; | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 liz.li
						liz.li